{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 9.2　pyecharts基础知识"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.2.1　快速绘制图表"
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "jupyter": {
     "is_executing": true
    }
   },
   "source": [
    "from pyecharts.charts import Bar\n",
    "from pyecharts import options as opts\n",
    "# 创建 Bar 类的对象 , 并指定画布的大小\n",
    "bar = Bar(init_opts=opts.InitOpts(width='600px', height='300px' ))\n",
    "# 添加 x 轴和 y 轴的数据\n",
    "bar.add_xaxis([\"衬衫\", \"羊毛衫\", \"雪纺衫\", \"裤子\", \"高跟鞋\", \"袜子\"])\n",
    "bar.add_yaxis(\"商家A\", [5, 20, 36, 10, 75, 90])\n",
    "# 设置标题、y 轴标签\n",
    "bar.set_global_opts(title_opts=opts.TitleOpts(title=\"柱形图示例\"),\n",
    "                    yaxis_opts=opts.AxisOpts(name=\"销售额(万元)\", name_location=\"center\", name_gap=30))\n",
    "bar.render_notebook()"
   ],
   "outputs": [],
   "execution_count": null
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"11ad175cb1bc46a4b26d5bf14e07a93d\" style=\"width:600px; height:300px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_11ad175cb1bc46a4b26d5bf14e07a93d = echarts.init(\n",
       "                    document.getElementById('11ad175cb1bc46a4b26d5bf14e07a93d'), 'white', {renderer: 'canvas'});\n",
       "                var option_11ad175cb1bc46a4b26d5bf14e07a93d = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                5,\n",
       "                20,\n",
       "                36,\n",
       "                10,\n",
       "                75,\n",
       "                90\n",
       "            ],\n",
       "            \"showBackground\": false,\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u886c\\u886b\",\n",
       "                \"\\u7f8a\\u6bdb\\u886b\",\n",
       "                \"\\u96ea\\u7eba\\u886b\",\n",
       "                \"\\u88e4\\u5b50\",\n",
       "                \"\\u9ad8\\u8ddf\\u978b\",\n",
       "                \"\\u889c\\u5b50\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\\u9500\\u552e\\u989d(\\u4e07)\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"center\",\n",
       "            \"nameGap\": 30,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u67f1\\u5f62\\u56fe\\u793a\\u4f8b\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_11ad175cb1bc46a4b26d5bf14e07a93d.setOption(option_11ad175cb1bc46a4b26d5bf14e07a93d);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x6875a30>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import Bar\n",
    "from pyecharts import options as opts\n",
    "bar = (\n",
    "    Bar(init_opts=opts.InitOpts(width='600px', height='300px'))\n",
    "    .add_xaxis([\"衬衫\", \"羊毛衫\", \"雪纺衫\", \"裤子\", \"高跟鞋\", \"袜子\"])\n",
    "    .add_yaxis(\"商家A\", [5, 20, 36, 10, 75, 90])\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"柱形图示例\"),\n",
    "                   yaxis_opts=opts.AxisOpts(name=\"销售额(万元)\", name_location=\"center\", name_gap=30))\n",
    ")\n",
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 9.3　绘制常用图表"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.3.1　绘制折线图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"6ad80221c76f49e19a8a4af4dfb0340e\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_6ad80221c76f49e19a8a4af4dfb0340e = echarts.init(\n",
       "                    document.getElementById('6ad80221c76f49e19a8a4af4dfb0340e'), 'white', {renderer: 'canvas'});\n",
       "                var option_6ad80221c76f49e19a8a4af4dfb0340e = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbol\": \"diamond\",\n",
       "            \"symbolSize\": 15,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u53ef\\u4e50\",\n",
       "                    102\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u96ea\\u78a7\",\n",
       "                    132\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5564\\u9152\",\n",
       "                    105\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u6a59\\u6c41\",\n",
       "                    52\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5976\\u8336\",\n",
       "                    90\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbol\": \"triangle\",\n",
       "            \"symbolSize\": 15,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u53ef\\u4e50\",\n",
       "                    86\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u96ea\\u78a7\",\n",
       "                    108\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5564\\u9152\",\n",
       "                    128\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u6a59\\u6c41\",\n",
       "                    66\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5976\\u8336\",\n",
       "                    136\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u53ef\\u4e50\",\n",
       "                \"\\u96ea\\u78a7\",\n",
       "                \"\\u5564\\u9152\",\n",
       "                \"\\u6a59\\u6c41\",\n",
       "                \"\\u5976\\u8336\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\\u9500\\u552e\\u989d(\\u4e07)\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"center\",\n",
       "            \"nameGap\": 30,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u6298\\u7ebf\\u56fe\\u793a\\u4f8b\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_6ad80221c76f49e19a8a4af4dfb0340e.setOption(option_6ad80221c76f49e19a8a4af4dfb0340e);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x68cfca0>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pyecharts.options as opts\n",
    "from pyecharts.charts import Line\n",
    "line_demo = (\n",
    "    Line()\n",
    "    # 添加x轴、y轴的数据、系列名称\n",
    "    .add_xaxis(['可乐', '雪碧', '啤酒', '橙汁', '奶茶'])\n",
    "    .add_yaxis('商家A', [102, 132, 105, 52, 90], symbol='diamond', symbol_size=15)\n",
    "    .add_yaxis('商家B', [86, 108, 128, 66, 136], symbol='triangle', symbol_size=15)\n",
    "    # 设置标题、y 轴标签\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"折线图示例\"), \n",
    "                   yaxis_opts=opts.AxisOpts(name=\"销售额(万元)\",name_location=\"center\", name_gap=30))\n",
    ")\n",
    "line_demo.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.3.2　绘制饼图或圆环图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"a3885f1719f94d0c8493bb01d831a5e7\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_a3885f1719f94d0c8493bb01d831a5e7 = echarts.init(\n",
       "                    document.getElementById('a3885f1719f94d0c8493bb01d831a5e7'), 'white', {renderer: 'canvas'});\n",
       "                var option_a3885f1719f94d0c8493bb01d831a5e7 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"pie\",\n",
       "            \"clockwise\": true,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5c0f\\u7c73\",\n",
       "                    \"value\": 150\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e09\\u661f\",\n",
       "                    \"value\": 20\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u534e\\u4e3a\",\n",
       "                    \"value\": 120\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u82f9\\u679c\",\n",
       "                    \"value\": 120\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9b45\\u65cf\",\n",
       "                    \"value\": 117\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"vivo\",\n",
       "                    \"value\": 145\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"OPPO\",\n",
       "                    \"value\": 128\n",
       "                }\n",
       "            ],\n",
       "            \"radius\": [\n",
       "                \"0%\",\n",
       "                \"75%\"\n",
       "            ],\n",
       "            \"center\": [\n",
       "                \"50%\",\n",
       "                \"50%\"\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5c0f\\u7c73\",\n",
       "                \"\\u4e09\\u661f\",\n",
       "                \"\\u534e\\u4e3a\",\n",
       "                \"\\u82f9\\u679c\",\n",
       "                \"\\u9b45\\u65cf\",\n",
       "                \"vivo\",\n",
       "                \"OPPO\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u997c\\u56fe\\u793a\\u4f8b\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_a3885f1719f94d0c8493bb01d831a5e7.setOption(option_a3885f1719f94d0c8493bb01d831a5e7);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x67eaa30>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pyecharts.options as opts\n",
    "from pyecharts.charts import Pie\n",
    "pie_demo = (\n",
    "    Pie()\n",
    "    .add(\"\", [('小米', 150), ('三星', 20), ('华为', 120), ('苹果', 120), ('魅族', 117), ('vivo', 145), ('OPPO', 128)])\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"饼图示例\"))\n",
    ")\n",
    "pie_demo.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"28e0a08b0b31453eab69106c9859fa37\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_28e0a08b0b31453eab69106c9859fa37 = echarts.init(\n",
       "                    document.getElementById('28e0a08b0b31453eab69106c9859fa37'), 'white', {renderer: 'canvas'});\n",
       "                var option_28e0a08b0b31453eab69106c9859fa37 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"pie\",\n",
       "            \"clockwise\": true,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5c0f\\u7c73\",\n",
       "                    \"value\": 150\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e09\\u661f\",\n",
       "                    \"value\": 20\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u534e\\u4e3a\",\n",
       "                    \"value\": 120\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u82f9\\u679c\",\n",
       "                    \"value\": 120\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9b45\\u65cf\",\n",
       "                    \"value\": 117\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"vivo\",\n",
       "                    \"value\": 145\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"OPPO\",\n",
       "                    \"value\": 128\n",
       "                }\n",
       "            ],\n",
       "            \"radius\": [\n",
       "                100,\n",
       "                160\n",
       "            ],\n",
       "            \"center\": [\n",
       "                \"50%\",\n",
       "                \"50%\"\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5c0f\\u7c73\",\n",
       "                \"\\u4e09\\u661f\",\n",
       "                \"\\u534e\\u4e3a\",\n",
       "                \"\\u82f9\\u679c\",\n",
       "                \"\\u9b45\\u65cf\",\n",
       "                \"vivo\",\n",
       "                \"OPPO\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u5706\\u73af\\u56fe\\u793a\\u4f8b\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_28e0a08b0b31453eab69106c9859fa37.setOption(option_28e0a08b0b31453eab69106c9859fa37);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x68df220>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pyecharts.options as opts\n",
    "from pyecharts.charts import Pie\n",
    "pie_demo = (\n",
    "    Pie()\n",
    "    # 添加数据\n",
    "    .add(\"\", [('小米', 150), ('三星', 20), ('华为', 120), ('苹果', 120), ('魅族', 117), ('vivo', 145), \n",
    "              ('OPPO', 128)], center=[\"50%\", \"50%\"], radius=[100, 160])\n",
    "    # 设置标题\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"圆环图示例\"))\n",
    ")\n",
    "pie_demo.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.3.3　绘制散点图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"094d78a4273b4fcdbfad3ffba6858c50\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_094d78a4273b4fcdbfad3ffba6858c50 = echarts.init(\n",
       "                    document.getElementById('094d78a4273b4fcdbfad3ffba6858c50'), 'white', {renderer: 'canvas'});\n",
       "                var option_094d78a4273b4fcdbfad3ffba6858c50 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"scatter\",\n",
       "            \"symbolSize\": 10,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u5468\\u4e00\",\n",
       "                    30\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u4e8c\",\n",
       "                    108\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u4e09\",\n",
       "                    73\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u56db\",\n",
       "                    116\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u4e94\",\n",
       "                    73\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u516d\",\n",
       "                    143\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u65e5\",\n",
       "                    106\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"right\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5468\\u4e00\",\n",
       "                \"\\u5468\\u4e8c\",\n",
       "                \"\\u5468\\u4e09\",\n",
       "                \"\\u5468\\u56db\",\n",
       "                \"\\u5468\\u4e94\",\n",
       "                \"\\u5468\\u516d\",\n",
       "                \"\\u5468\\u65e5\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\\u7528\\u6237\\u6d3b\\u8dc3\\u91cf(\\u4eba)\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"center\",\n",
       "            \"nameGap\": 30,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u6563\\u70b9\\u56fe\\u793a\\u4f8b\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_094d78a4273b4fcdbfad3ffba6858c50.setOption(option_094d78a4273b4fcdbfad3ffba6858c50);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x68cf340>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pyecharts.options as opts\n",
    "from pyecharts.charts import Scatter\n",
    "scatter_demo = (\n",
    "    Scatter()\n",
    "    .add_xaxis(['周一', '周二', '周三', '周四', '周五', '周六', '周日'])\n",
    "    .add_yaxis(\"\", [30, 108, 73, 116, 73, 143, 106])\n",
    "    # 设置标题、x 轴网格、y 轴网格和标签\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"散点图示例\"), \n",
    "                   xaxis_opts=opts.AxisOpts(splitline_opts=opts.SplitLineOpts(is_show=True)),\n",
    "                   yaxis_opts=opts.AxisOpts(splitline_opts=opts.SplitLineOpts(is_show=True), name=\"用户活跃量(人)\",\n",
    "                                            name_location=\"center\", name_gap=30)\n",
    "    )\n",
    ")\n",
    "scatter_demo.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"acf79ededfa7403f9cc829f60b916262\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_acf79ededfa7403f9cc829f60b916262 = echarts.init(\n",
       "                    document.getElementById('acf79ededfa7403f9cc829f60b916262'), 'white', {renderer: 'canvas'});\n",
       "                var option_acf79ededfa7403f9cc829f60b916262 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"effectScatter\",\n",
       "            \"showEffectOn\": \"render\",\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            },\n",
       "            \"symbol\": \"pin\",\n",
       "            \"symbolSize\": 10,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u5468\\u4e00\",\n",
       "                    30\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u4e8c\",\n",
       "                    108\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u4e09\",\n",
       "                    73\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u56db\",\n",
       "                    116\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u4e94\",\n",
       "                    73\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u516d\",\n",
       "                    143\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u65e5\",\n",
       "                    106\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5468\\u4e00\",\n",
       "                \"\\u5468\\u4e8c\",\n",
       "                \"\\u5468\\u4e09\",\n",
       "                \"\\u5468\\u56db\",\n",
       "                \"\\u5468\\u4e94\",\n",
       "                \"\\u5468\\u516d\",\n",
       "                \"\\u5468\\u65e5\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \" \\u7528\\u6237\\u6d3b\\u8dc3\\u91cf ( \\u4eba)\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"center\",\n",
       "            \"nameGap\": 30,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \" \\u6d9f\\u6f2a\\u7279\\u6548\\u6563\\u70b9\\u56fe\\u793a\\u4f8b\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_acf79ededfa7403f9cc829f60b916262.setOption(option_acf79ededfa7403f9cc829f60b916262);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x6875f10>"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pyecharts.options as opts\n",
    "from pyecharts.charts import EffectScatter\n",
    "effect_scatter = (\n",
    "    EffectScatter()\n",
    "    .add_xaxis(['周一', '周二', '周三', '周四', '周五', '周六', '周日'])\n",
    "    .add_yaxis(\"\", [30, 108, 73, 116, 73, 143, 106], symbol='pin')\n",
    "    # 设置标题、x 轴网格、y 轴网格和标签\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"涟漪特效散点图示例\"), \n",
    "                     xaxis_opts=opts.AxisOpts(splitline_opts=opts.SplitLineOpts(is_show=True)),\n",
    "                     yaxis_opts=opts.AxisOpts(splitline_opts=opts.SplitLineOpts(is_show=True), \n",
    "                                              name=\" 用户活跃量(人)\",name_location=\"center\", name_gap=30)\n",
    "    )\n",
    ")\n",
    "effect_scatter.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.3.4　绘制3D柱形图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'echarts-gl':'https://assets.pyecharts.org/assets/echarts-gl.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"1a8c7844e69847d896da7701bedb1529\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'echarts-gl'], function(echarts) {\n",
       "                var chart_1a8c7844e69847d896da7701bedb1529 = echarts.init(\n",
       "                    document.getElementById('1a8c7844e69847d896da7701bedb1529'), 'white', {renderer: 'canvas'});\n",
       "                var option_1a8c7844e69847d896da7701bedb1529 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar3D\",\n",
       "            \"data\": [\n",
       "                [\n",
       "                    0,\n",
       "                    0,\n",
       "                    10\n",
       "                ],\n",
       "                [\n",
       "                    1,\n",
       "                    0,\n",
       "                    5\n",
       "                ],\n",
       "                [\n",
       "                    2,\n",
       "                    0,\n",
       "                    17\n",
       "                ],\n",
       "                [\n",
       "                    3,\n",
       "                    0,\n",
       "                    20\n",
       "                ],\n",
       "                [\n",
       "                    4,\n",
       "                    0,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    0,\n",
       "                    1,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    1,\n",
       "                    1,\n",
       "                    19\n",
       "                ],\n",
       "                [\n",
       "                    2,\n",
       "                    1,\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    3,\n",
       "                    1,\n",
       "                    9\n",
       "                ],\n",
       "                [\n",
       "                    4,\n",
       "                    1,\n",
       "                    3\n",
       "                ],\n",
       "                [\n",
       "                    0,\n",
       "                    2,\n",
       "                    2\n",
       "                ],\n",
       "                [\n",
       "                    1,\n",
       "                    2,\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    2,\n",
       "                    2,\n",
       "                    5\n",
       "                ],\n",
       "                [\n",
       "                    3,\n",
       "                    2,\n",
       "                    5\n",
       "                ],\n",
       "                [\n",
       "                    4,\n",
       "                    2,\n",
       "                    4\n",
       "                ],\n",
       "                [\n",
       "                    0,\n",
       "                    3,\n",
       "                    12\n",
       "                ],\n",
       "                [\n",
       "                    1,\n",
       "                    3,\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    2,\n",
       "                    3,\n",
       "                    14\n",
       "                ],\n",
       "                [\n",
       "                    3,\n",
       "                    3,\n",
       "                    15\n",
       "                ],\n",
       "                [\n",
       "                    4,\n",
       "                    3,\n",
       "                    11\n",
       "                ],\n",
       "                [\n",
       "                    0,\n",
       "                    4,\n",
       "                    1\n",
       "                ],\n",
       "                [\n",
       "                    1,\n",
       "                    4,\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    2,\n",
       "                    4,\n",
       "                    17\n",
       "                ],\n",
       "                [\n",
       "                    3,\n",
       "                    4,\n",
       "                    14\n",
       "                ],\n",
       "                [\n",
       "                    4,\n",
       "                    4,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    0,\n",
       "                    5,\n",
       "                    18\n",
       "                ],\n",
       "                [\n",
       "                    1,\n",
       "                    5,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    2,\n",
       "                    5,\n",
       "                    15\n",
       "                ],\n",
       "                [\n",
       "                    3,\n",
       "                    5,\n",
       "                    14\n",
       "                ],\n",
       "                [\n",
       "                    4,\n",
       "                    5,\n",
       "                    19\n",
       "                ],\n",
       "                [\n",
       "                    0,\n",
       "                    6,\n",
       "                    15\n",
       "                ],\n",
       "                [\n",
       "                    1,\n",
       "                    6,\n",
       "                    16\n",
       "                ],\n",
       "                [\n",
       "                    2,\n",
       "                    6,\n",
       "                    7\n",
       "                ],\n",
       "                [\n",
       "                    3,\n",
       "                    6,\n",
       "                    0\n",
       "                ],\n",
       "                [\n",
       "                    4,\n",
       "                    6,\n",
       "                    14\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"visualMap\": {\n",
       "        \"show\": true,\n",
       "        \"type\": \"continuous\",\n",
       "        \"min\": 0,\n",
       "        \"max\": 30,\n",
       "        \"inRange\": {\n",
       "            \"color\": [\n",
       "                \"#50a3ba\",\n",
       "                \"#eac763\",\n",
       "                \"#d94e5d\"\n",
       "            ]\n",
       "        },\n",
       "        \"calculable\": true,\n",
       "        \"inverse\": false,\n",
       "        \"splitNumber\": 5,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"showLabel\": true,\n",
       "        \"itemWidth\": 20,\n",
       "        \"itemHeight\": 140,\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"xAxis3D\": {\n",
       "        \"data\": [\n",
       "            \"A\\u7ec4\",\n",
       "            \"B\\u7ec4\",\n",
       "            \"C\\u7ec4\",\n",
       "            \"D\\u7ec4\",\n",
       "            \"E\\u7ec4\"\n",
       "        ],\n",
       "        \"nameGap\": 20,\n",
       "        \"type\": \"category\",\n",
       "        \"axisLabel\": {\n",
       "            \"margin\": 8\n",
       "        }\n",
       "    },\n",
       "    \"yAxis3D\": {\n",
       "        \"data\": [\n",
       "            \"\\u5468\\u4e00\",\n",
       "            \"\\u5468\\u4e8c\",\n",
       "            \"\\u5468\\u4e09\",\n",
       "            \"\\u5468\\u56db\",\n",
       "            \"\\u5468\\u4e94\",\n",
       "            \"\\u5468\\u516d\",\n",
       "            \"\\u5468\\u65e5\"\n",
       "        ],\n",
       "        \"nameGap\": 20,\n",
       "        \"type\": \"category\",\n",
       "        \"axisLabel\": {\n",
       "            \"margin\": 8\n",
       "        }\n",
       "    },\n",
       "    \"zAxis3D\": {\n",
       "        \"name\": \"\\u9500\\u552e\\u989d(\\u4e07)\",\n",
       "        \"nameGap\": 20,\n",
       "        \"type\": \"value\",\n",
       "        \"axisLabel\": {\n",
       "            \"margin\": 8\n",
       "        }\n",
       "    },\n",
       "    \"grid3D\": {\n",
       "        \"boxWidth\": 200,\n",
       "        \"boxHeight\": 100,\n",
       "        \"boxDepth\": 80,\n",
       "        \"viewControl\": {\n",
       "            \"autoRotate\": false,\n",
       "            \"autoRotateSpeed\": 10,\n",
       "            \"rotateSensitivity\": 1\n",
       "        }\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"3D\\u67f1\\u5f62\\u56fe\\u793a\\u4f8b\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_1a8c7844e69847d896da7701bedb1529.setOption(option_1a8c7844e69847d896da7701bedb1529);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x68d9fd0>"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import random\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Bar3D\n",
    "data = [(i, j, random.randint(0, 20)) for i in range(7) for j in range(5)]\n",
    "bar_3d = (\n",
    "    Bar3D()\n",
    "    .add(\"\", [[d[1], d[0], d[2]] for d in data], \n",
    "         xaxis3d_opts=opts.Axis3DOpts(['A组', 'B组', 'C组','D组', 'E组'], type_=\"category\", name=\"\"),\n",
    "         yaxis3d_opts=opts.Axis3DOpts(['周一', '周二', '周三', '周四', '周五', '周六', '周日'], type_=\"category\", name=\"\"),\n",
    "         zaxis3d_opts=opts.Axis3DOpts(type_=\"value\", name=\"销售额(万元)\")\n",
    "    )\n",
    "    .set_global_opts(\n",
    "        visualmap_opts=opts.VisualMapOpts(max_=30), title_opts=opts.TitleOpts(title=\"3D柱形图示例\")\n",
    "    )\n",
    ")\n",
    "bar_3d.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.3.5　绘制统计地图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', '朔州':'https://assets.pyecharts.org/assets/maps/shan1_xi1_shuo4_zhou1'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"303429ee35714a66a7d9356c3dff99da\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', '朔州'], function(echarts) {\n",
       "                var chart_303429ee35714a66a7d9356c3dff99da = echarts.init(\n",
       "                    document.getElementById('303429ee35714a66a7d9356c3dff99da'), 'white', {renderer: 'canvas'});\n",
       "                var option_303429ee35714a66a7d9356c3dff99da = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"map\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"mapType\": \"\\u6714\\u5dde\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u6714\\u57ce\\u533a\",\n",
       "                    \"value\": 100\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e73\\u9c81\\u533a\",\n",
       "                    \"value\": 88\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c71\\u9634\\u53bf\",\n",
       "                    \"value\": 99\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e94\\u53bf\",\n",
       "                    \"value\": 68\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u53f3\\u7389\\u53bf\",\n",
       "                    \"value\": 35\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6000\\u4ec1\\u53bf\",\n",
       "                    \"value\": 28\n",
       "                }\n",
       "            ],\n",
       "            \"roam\": true,\n",
       "            \"aspectScale\": 0.75,\n",
       "            \"nameProperty\": \"name\",\n",
       "            \"selectedMode\": false,\n",
       "            \"zoom\": 1,\n",
       "            \"mapValueCalculation\": \"sum\",\n",
       "            \"showLegendSymbol\": true,\n",
       "            \"emphasis\": {}\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u6714\\u5dde\\u5730\\u56fe\\u793a\\u4f8b\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"visualMap\": {\n",
       "        \"show\": true,\n",
       "        \"type\": \"continuous\",\n",
       "        \"min\": 0,\n",
       "        \"max\": 100,\n",
       "        \"inRange\": {\n",
       "            \"color\": [\n",
       "                \"#50a3ba\",\n",
       "                \"#eac763\",\n",
       "                \"#d94e5d\"\n",
       "            ]\n",
       "        },\n",
       "        \"calculable\": true,\n",
       "        \"inverse\": false,\n",
       "        \"splitNumber\": 5,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"showLabel\": true,\n",
       "        \"itemWidth\": 20,\n",
       "        \"itemHeight\": 140,\n",
       "        \"borderWidth\": 0\n",
       "    }\n",
       "};\n",
       "                chart_303429ee35714a66a7d9356c3dff99da.setOption(option_303429ee35714a66a7d9356c3dff99da);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x6920190>"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Map\n",
    "data_map = [['朔城区', 100], ['平鲁区', 88], ['山阴县', 99], ['应县', 68], ['右玉县', 35], ['怀仁县', 28]]\n",
    "# 创建 Map 对象\n",
    "map_demo = (\n",
    "    Map()\n",
    "    .add(\"商家A\", data_map, \"朔州\")\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"朔州地图示例\"), visualmap_opts=opts.VisualMapOpts())\n",
    ")\n",
    "map_demo.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.3.6　绘制漏斗图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"7d1c45e010e24deb96629b7202464752\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_7d1c45e010e24deb96629b7202464752 = echarts.init(\n",
       "                    document.getElementById('7d1c45e010e24deb96629b7202464752'), 'white', {renderer: 'canvas'});\n",
       "                var option_7d1c45e010e24deb96629b7202464752 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"funnel\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u8bbf\\u95ee\\u5546\\u54c1\",\n",
       "                    \"value\": 100\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u52a0\\u8d2d\\u7269\\u8f66\",\n",
       "                    \"value\": 50\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u751f\\u6210\\u8ba2\\u5355\",\n",
       "                    \"value\": 30\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u652f\\u4ed8\\u8ba2\\u5355\",\n",
       "                    \"value\": 20\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5b8c\\u6210\\u4ea4\\u6613\",\n",
       "                    \"value\": 15\n",
       "                }\n",
       "            ],\n",
       "            \"sort\": \"descending\",\n",
       "            \"gap\": 0,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"showContent\": true,\n",
       "                \"alwaysShowContent\": false,\n",
       "                \"showDelay\": 0,\n",
       "                \"hideDelay\": 100,\n",
       "                \"formatter\": \"{a} <br/>{b} : {c}%\",\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0,\n",
       "                \"padding\": 5\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5b8c\\u6210\\u4ea4\\u6613\",\n",
       "                \"\\u652f\\u4ed8\\u8ba2\\u5355\",\n",
       "                \"\\u8bbf\\u95ee\\u5546\\u54c1\",\n",
       "                \"\\u751f\\u6210\\u8ba2\\u5355\",\n",
       "                \"\\u52a0\\u8d2d\\u7269\\u8f66\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u8bbf\\u95ee\\u5546\\u54c1\": true,\n",
       "                \"\\u52a0\\u8d2d\\u7269\\u8f66\": true,\n",
       "                \"\\u751f\\u6210\\u8ba2\\u5355\": true,\n",
       "                \"\\u652f\\u4ed8\\u8ba2\\u5355\": true,\n",
       "                \"\\u5b8c\\u6210\\u4ea4\\u6613\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u6f0f\\u6597\\u56fe\\u793a\\u4f8b\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_7d1c45e010e24deb96629b7202464752.setOption(option_7d1c45e010e24deb96629b7202464752);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x69209a0>"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Funnel\n",
    "data_fun = [['访问商品', 100], ['加购物车', 50], ['生成订单', 30], ['支付订单', 20], ['完成交易', 15]]\n",
    "# 创建 Funnel 对象\n",
    "funnel_demo = (\n",
    "    Funnel()\n",
    "    .add(\"\", data_fun, sort_='descending', tooltip_opts=opts.TooltipOpts(trigger=\"item\", formatter=\"{a} <br/>{b} : {c}%\"))\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"漏斗图示例\"))\n",
    ")\n",
    "funnel_demo.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.3.7　绘制桑基图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"083e1a3d4f9e486ba5887ea4642c6852\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_083e1a3d4f9e486ba5887ea4642c6852 = echarts.init(\n",
       "                    document.getElementById('083e1a3d4f9e486ba5887ea4642c6852'), 'white', {renderer: 'canvas'});\n",
       "                var option_083e1a3d4f9e486ba5887ea4642c6852 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"sankey\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u6d88\\u8d39\\u8005\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8001\\u5ba2\\u6237\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u65b0\\u5ba2\\u6237\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8fd0\\u52a8\\u978b\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u886c\\u886b\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8fde\\u8863\\u88d9\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9ad8\\u8ddf\\u978b\"\n",
       "                }\n",
       "            ],\n",
       "            \"links\": [\n",
       "                {\n",
       "                    \"source\": \"\\u6d88\\u8d39\\u8005\",\n",
       "                    \"target\": \"\\u8001\\u5ba2\\u6237\",\n",
       "                    \"value\": 30\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u6d88\\u8d39\\u8005\",\n",
       "                    \"target\": \"\\u65b0\\u5ba2\\u6237\",\n",
       "                    \"value\": 20\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u8001\\u5ba2\\u6237\",\n",
       "                    \"target\": \"\\u8fd0\\u52a8\\u978b\",\n",
       "                    \"value\": 10\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u8001\\u5ba2\\u6237\",\n",
       "                    \"target\": \"\\u886c\\u886b\",\n",
       "                    \"value\": 20\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u65b0\\u5ba2\\u6237\",\n",
       "                    \"target\": \"\\u8fde\\u8863\\u88d9\",\n",
       "                    \"value\": 10\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"\\u65b0\\u5ba2\\u6237\",\n",
       "                    \"target\": \"\\u9ad8\\u8ddf\\u978b\",\n",
       "                    \"value\": 10\n",
       "                }\n",
       "            ],\n",
       "            \"left\": \"5%\",\n",
       "            \"top\": \"5%\",\n",
       "            \"right\": \"20%\",\n",
       "            \"bottom\": \"5%\",\n",
       "            \"nodeWidth\": 20,\n",
       "            \"nodeGap\": 8,\n",
       "            \"nodeAlign\": \"justify\",\n",
       "            \"layoutIteration\": 32,\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"draggable\": true,\n",
       "            \"focusNodeAdjacency\": false,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"right\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 0.2,\n",
       "                \"curveness\": 0.5,\n",
       "                \"type\": \"solid\",\n",
       "                \"color\": \"source\"\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u6851\\u57fa\\u56fe\\u793a\\u4f8b\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_083e1a3d4f9e486ba5887ea4642c6852.setOption(option_083e1a3d4f9e486ba5887ea4642c6852);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x6949790>"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Sankey\n",
    "nodes = [\n",
    "    {\"name\":\"消费者\"},\n",
    "    {\"name\":\"老客户\"},\n",
    "    {\"name\":\"新客户\"},\n",
    "    {\"name\":\"运动鞋\"},\n",
    "    {\"name\":\"衬衫\"},\n",
    "    {\"name\":\"连衣裙\"},\n",
    "    {\"name\":\"高跟鞋\"}\n",
    "]\n",
    "links = [\n",
    "    {\"source\":\"消费者\", \"target\":\"老客户\", \"value\": 30},\n",
    "    {\"source\":\"消费者\", \"target\":\"新客户\", \"value\": 20},\n",
    "    {\"source\":\"老客户\", \"target\":\"运动鞋\", \"value\": 10},\n",
    "    {\"source\":\"老客户\", \"target\":\"衬衫\", \"value\": 20},\n",
    "    {\"source\":\"新客户\", \"target\":\"连衣裙\", \"value\": 10},\n",
    "    {\"source\":\"新客户\", \"target\":\"高跟鞋\", \"value\": 10}\n",
    "]\n",
    "sankey_demo = (\n",
    "    Sankey()\n",
    "    .add(\"\", nodes=nodes, links=links,linestyle_opt=opts.LineStyleOpts(opacity=0.2, curve=0.5, color=\"source\"),\n",
    "         label_opts=opts.LabelOpts(position=\"right\"))\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"桑基图示例\"))\n",
    ")\n",
    "sankey_demo.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 9.4　绘制组合图表"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.4.1　并行多图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"1d48a8cf8e5d4a348df150ed481e2adc\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_1d48a8cf8e5d4a348df150ed481e2adc = echarts.init(\n",
       "                    document.getElementById('1d48a8cf8e5d4a348df150ed481e2adc'), 'white', {renderer: 'canvas'});\n",
       "                var option_1d48a8cf8e5d4a348df150ed481e2adc = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"xAxisIndex\": 0,\n",
       "            \"yAxisIndex\": 0,\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                107,\n",
       "                36,\n",
       "                102,\n",
       "                91,\n",
       "                51,\n",
       "                113,\n",
       "                45\n",
       "            ],\n",
       "            \"showBackground\": false,\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"xAxisIndex\": 0,\n",
       "            \"yAxisIndex\": 0,\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                104,\n",
       "                60,\n",
       "                33,\n",
       "                138,\n",
       "                105,\n",
       "                111,\n",
       "                91\n",
       "            ],\n",
       "            \"showBackground\": false,\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"connectNulls\": false,\n",
       "            \"xAxisIndex\": 1,\n",
       "            \"yAxisIndex\": 1,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u5c0f\\u7c73\",\n",
       "                    107\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e09\\u661f\",\n",
       "                    36\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u534e\\u4e3a\",\n",
       "                    102\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u82f9\\u679c\",\n",
       "                    91\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u9b45\\u65cf\",\n",
       "                    51\n",
       "                ],\n",
       "                [\n",
       "                    \"vivo\",\n",
       "                    113\n",
       "                ],\n",
       "                [\n",
       "                    \"OPPO\",\n",
       "                    45\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"connectNulls\": false,\n",
       "            \"xAxisIndex\": 1,\n",
       "            \"yAxisIndex\": 1,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u5c0f\\u7c73\",\n",
       "                    104\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e09\\u661f\",\n",
       "                    60\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u534e\\u4e3a\",\n",
       "                    33\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u82f9\\u679c\",\n",
       "                    138\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u9b45\\u65cf\",\n",
       "                    105\n",
       "                ],\n",
       "                [\n",
       "                    \"vivo\",\n",
       "                    111\n",
       "                ],\n",
       "                [\n",
       "                    \"OPPO\",\n",
       "                    91\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        },\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"top\": \"48%\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5c0f\\u7c73\",\n",
       "                \"\\u4e09\\u661f\",\n",
       "                \"\\u534e\\u4e3a\",\n",
       "                \"\\u82f9\\u679c\",\n",
       "                \"\\u9b45\\u65cf\",\n",
       "                \"vivo\",\n",
       "                \"OPPO\"\n",
       "            ]\n",
       "        },\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 1,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5c0f\\u7c73\",\n",
       "                \"\\u4e09\\u661f\",\n",
       "                \"\\u534e\\u4e3a\",\n",
       "                \"\\u82f9\\u679c\",\n",
       "                \"\\u9b45\\u65cf\",\n",
       "                \"vivo\",\n",
       "                \"OPPO\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\\u9500\\u552e\\u989d(\\u4e07)\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"center\",\n",
       "            \"nameGap\": 30,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"name\": \"\\u9500\\u552e\\u989d(\\u4e07)\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"center\",\n",
       "            \"nameGap\": 30,\n",
       "            \"gridIndex\": 1,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u7ec4\\u5408\\u56fe\\u8868-\\u67f1\\u5f62\\u56fe\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        },\n",
       "        {\n",
       "            \"text\": \"\\u7ec4\\u5408\\u56fe\\u8868-\\u6298\\u7ebf\\u56fe \",\n",
       "            \"top\": \"48%\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"grid\": [\n",
       "        {\n",
       "            \"show\": false,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"bottom\": \"60%\",\n",
       "            \"containLabel\": false,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderWidth\": 1\n",
       "        },\n",
       "        {\n",
       "            \"show\": false,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"top\": \"60%\",\n",
       "            \"containLabel\": false,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderWidth\": 1\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_1d48a8cf8e5d4a348df150ed481e2adc.setOption(option_1d48a8cf8e5d4a348df150ed481e2adc);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x6920d00>"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Bar, Line, Grid\n",
    "x_data = ['小米', '三星', '华为', '苹果', '魅族', 'vivo', 'OPPO']\n",
    "y_a = [107, 36, 102, 91, 51, 113, 45]\n",
    "y_b = [104, 60, 33, 138, 105, 111, 91]\n",
    "bar = (\n",
    "    Bar()\n",
    "    .add_xaxis(x_data)\n",
    "    .add_yaxis(\"商家A\", y_a)\n",
    "    .add_yaxis(\"商家B\", y_b)\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"组合图表-柱形图\"), \n",
    "                     yaxis_opts=opts.AxisOpts(name=\"销售额(万元)\",name_location=\"center\", name_gap=30))\n",
    ")\n",
    "line = (\n",
    "    Line()\n",
    "    .add_xaxis(x_data)\n",
    "    .add_yaxis(\"商家A\", y_a)\n",
    "    .add_yaxis(\"商家B\", y_b)\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"组合图表-折线图 \", pos_top=\"48%\"),legend_opts=opts.LegendOpts(pos_top=\"48%\"),\n",
    "        yaxis_opts=opts.AxisOpts(name=\"销售额(万元)\", name_location=\"center\", name_gap=30)\n",
    "    )\n",
    ")\n",
    "# 创建组合图表, 并以上下布局的方式显示柱形图和折线图\n",
    "grid = (\n",
    "    Grid()\n",
    "    .add(bar, grid_opts=opts.GridOpts(pos_bottom=\"60%\"))\n",
    "    .add(line, grid_opts=opts.GridOpts(pos_top=\"60%\"))\n",
    ")\n",
    "grid.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.4.2　顺序多图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"e53bc0dc3b514a8e8647c2364d09ef06\" style=\"width:900px; height:500px;\"></div>\n",
       "        <div id=\"cf12eea5e0664d4b9ff2f7aaef9c3371\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_e53bc0dc3b514a8e8647c2364d09ef06 = echarts.init(\n",
       "                    document.getElementById('e53bc0dc3b514a8e8647c2364d09ef06'), 'white', {renderer: 'canvas'});\n",
       "                var option_e53bc0dc3b514a8e8647c2364d09ef06 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                107,\n",
       "                36,\n",
       "                102,\n",
       "                91,\n",
       "                51,\n",
       "                113,\n",
       "                45\n",
       "            ],\n",
       "            \"showBackground\": false,\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                104,\n",
       "                60,\n",
       "                33,\n",
       "                138,\n",
       "                105,\n",
       "                111,\n",
       "                91\n",
       "            ],\n",
       "            \"showBackground\": false,\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5c0f\\u7c73\",\n",
       "                \"\\u4e09\\u661f\",\n",
       "                \"\\u534e\\u4e3a\",\n",
       "                \"\\u82f9\\u679c\",\n",
       "                \"\\u9b45\\u65cf\",\n",
       "                \"vivo\",\n",
       "                \"OPPO\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\\u9500\\u552e\\u989d(\\u4e07)\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"center\",\n",
       "            \"nameGap\": 30,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u7ec4\\u5408\\u56fe\\u8868-\\u67f1\\u5f62\\u56fe\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_e53bc0dc3b514a8e8647c2364d09ef06.setOption(option_e53bc0dc3b514a8e8647c2364d09ef06);\n",
       "                var chart_cf12eea5e0664d4b9ff2f7aaef9c3371 = echarts.init(\n",
       "                    document.getElementById('cf12eea5e0664d4b9ff2f7aaef9c3371'), 'white', {renderer: 'canvas'});\n",
       "                var option_cf12eea5e0664d4b9ff2f7aaef9c3371 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u5c0f\\u7c73\",\n",
       "                    107\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e09\\u661f\",\n",
       "                    36\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u534e\\u4e3a\",\n",
       "                    102\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u82f9\\u679c\",\n",
       "                    91\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u9b45\\u65cf\",\n",
       "                    51\n",
       "                ],\n",
       "                [\n",
       "                    \"vivo\",\n",
       "                    113\n",
       "                ],\n",
       "                [\n",
       "                    \"OPPO\",\n",
       "                    45\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u5c0f\\u7c73\",\n",
       "                    104\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e09\\u661f\",\n",
       "                    60\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u534e\\u4e3a\",\n",
       "                    33\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u82f9\\u679c\",\n",
       "                    138\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u9b45\\u65cf\",\n",
       "                    105\n",
       "                ],\n",
       "                [\n",
       "                    \"vivo\",\n",
       "                    111\n",
       "                ],\n",
       "                [\n",
       "                    \"OPPO\",\n",
       "                    91\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5c0f\\u7c73\",\n",
       "                \"\\u4e09\\u661f\",\n",
       "                \"\\u534e\\u4e3a\",\n",
       "                \"\\u82f9\\u679c\",\n",
       "                \"\\u9b45\\u65cf\",\n",
       "                \"vivo\",\n",
       "                \"OPPO\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\\u9500\\u552e\\u989d(\\u4e07)\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"center\",\n",
       "            \"nameGap\": 30,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u7ec4\\u5408\\u56fe\\u8868-\\u6298\\u7ebf\\u56fe \",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_cf12eea5e0664d4b9ff2f7aaef9c3371.setOption(option_cf12eea5e0664d4b9ff2f7aaef9c3371);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x515ef40>"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Bar, Line, Page\n",
    "x_data = ['小米', '三星', '华为', '苹果', '魅族', 'vivo', 'OPPO']\n",
    "y_a = [107, 36, 102, 91, 51, 113, 45]\n",
    "y_b = [104, 60, 33, 138, 105, 111, 91]\n",
    "bar = (\n",
    "    Bar()\n",
    "    .add_xaxis(x_data)\n",
    "    .add_yaxis(\"商家A\", y_a)\n",
    "    .add_yaxis(\"商家B\", y_b)\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"组合图表-柱形图\"),\n",
    "                     yaxis_opts=opts.AxisOpts(name=\"销售额(万元)\",name_location=\"center\", name_gap=30))\n",
    ")\n",
    "line = (\n",
    "    Line()\n",
    "    .add_xaxis(x_data)\n",
    "    .add_yaxis(\"商家A\", y_a)\n",
    "    .add_yaxis(\"商家B\", y_b)\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"组合图表-折线图 \"),\n",
    "                     yaxis_opts=opts.AxisOpts(name=\"销售额(万元)\", name_location=\"center\", name_gap=30))\n",
    ")\n",
    "# 创建组合图表, 并在同一网页上按顺序显示柱形图和折线图\n",
    "page = Page()\n",
    "page.add(bar, line)\n",
    "page.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.4.3　选项卡多图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <style>\n",
       "        .tab {\n",
       "            overflow: hidden;\n",
       "            border: 1px solid #ccc;\n",
       "            background-color: #f1f1f1;\n",
       "        }\n",
       "\n",
       "        .tab button {\n",
       "            background-color: inherit;\n",
       "            float: left;\n",
       "            border: none;\n",
       "            outline: none;\n",
       "            cursor: pointer;\n",
       "            padding: 12px 16px;\n",
       "            transition: 0.3s;\n",
       "        }\n",
       "\n",
       "        .tab button:hover {\n",
       "            background-color: #ddd;\n",
       "        }\n",
       "\n",
       "        .tab button.active {\n",
       "            background-color: #ccc;\n",
       "        }\n",
       "\n",
       "        .chart-container {\n",
       "            display: none;\n",
       "            padding: 6px 12px;\n",
       "            border-top: none;\n",
       "        }\n",
       "    </style>\n",
       "<div class=\"tab\">\n",
       "            <button class=\"tablinks\" onclick=\"showChart(event, '295e34fa7b5140b1a8f01783ffda66f8')\">柱形图</button>\n",
       "            <button class=\"tablinks\" onclick=\"showChart(event, '92876428f70a4968b4ec2c9db0d55a69')\">折线图</button>\n",
       "    </div>\n",
       "\n",
       "        <div id=\"295e34fa7b5140b1a8f01783ffda66f8\" class=\"chart-container\" style=\"width:900px; height:500px;\"></div>\n",
       "        <div id=\"92876428f70a4968b4ec2c9db0d55a69\" class=\"chart-container\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_295e34fa7b5140b1a8f01783ffda66f8 = echarts.init(\n",
       "                    document.getElementById('295e34fa7b5140b1a8f01783ffda66f8'), 'white', {renderer: 'canvas'});\n",
       "                var option_295e34fa7b5140b1a8f01783ffda66f8 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                107,\n",
       "                36,\n",
       "                102,\n",
       "                91,\n",
       "                51,\n",
       "                113,\n",
       "                45\n",
       "            ],\n",
       "            \"showBackground\": false,\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                104,\n",
       "                60,\n",
       "                33,\n",
       "                138,\n",
       "                105,\n",
       "                111,\n",
       "                91\n",
       "            ],\n",
       "            \"showBackground\": false,\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5c0f\\u7c73\",\n",
       "                \"\\u4e09\\u661f\",\n",
       "                \"\\u534e\\u4e3a\",\n",
       "                \"\\u82f9\\u679c\",\n",
       "                \"\\u9b45\\u65cf\",\n",
       "                \"vivo\",\n",
       "                \"OPPO\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\\u9500\\u552e\\u989d(\\u4e07)\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"center\",\n",
       "            \"nameGap\": 30,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_295e34fa7b5140b1a8f01783ffda66f8.setOption(option_295e34fa7b5140b1a8f01783ffda66f8);\n",
       "                var chart_92876428f70a4968b4ec2c9db0d55a69 = echarts.init(\n",
       "                    document.getElementById('92876428f70a4968b4ec2c9db0d55a69'), 'white', {renderer: 'canvas'});\n",
       "                var option_92876428f70a4968b4ec2c9db0d55a69 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u5c0f\\u7c73\",\n",
       "                    107\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e09\\u661f\",\n",
       "                    36\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u534e\\u4e3a\",\n",
       "                    102\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u82f9\\u679c\",\n",
       "                    91\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u9b45\\u65cf\",\n",
       "                    51\n",
       "                ],\n",
       "                [\n",
       "                    \"vivo\",\n",
       "                    113\n",
       "                ],\n",
       "                [\n",
       "                    \"OPPO\",\n",
       "                    45\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u5c0f\\u7c73\",\n",
       "                    104\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e09\\u661f\",\n",
       "                    60\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u534e\\u4e3a\",\n",
       "                    33\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u82f9\\u679c\",\n",
       "                    138\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u9b45\\u65cf\",\n",
       "                    105\n",
       "                ],\n",
       "                [\n",
       "                    \"vivo\",\n",
       "                    111\n",
       "                ],\n",
       "                [\n",
       "                    \"OPPO\",\n",
       "                    91\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5c0f\\u7c73\",\n",
       "                \"\\u4e09\\u661f\",\n",
       "                \"\\u534e\\u4e3a\",\n",
       "                \"\\u82f9\\u679c\",\n",
       "                \"\\u9b45\\u65cf\",\n",
       "                \"vivo\",\n",
       "                \"OPPO\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\\u9500\\u552e\\u989d(\\u4e07)\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"center\",\n",
       "            \"nameGap\": 30,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_92876428f70a4968b4ec2c9db0d55a69.setOption(option_92876428f70a4968b4ec2c9db0d55a69);\n",
       "        });\n",
       "    </script>\n",
       "<script>\n",
       "        (function() {\n",
       "            containers = document.getElementsByClassName(\"chart-container\");\n",
       "            if(containers.length > 0) {\n",
       "                containers[0].style.display = \"block\";\n",
       "            }\n",
       "        })()\n",
       "\n",
       "        function showChart(evt, chartID) {\n",
       "            let containers = document.getElementsByClassName(\"chart-container\");\n",
       "            for (let i = 0; i < containers.length; i++) {\n",
       "                containers[i].style.display = \"none\";\n",
       "            }\n",
       "\n",
       "            let tablinks = document.getElementsByClassName(\"tablinks\");\n",
       "            for (let i = 0; i < tablinks.length; i++) {\n",
       "                tablinks[i].className = \"tablinks\";\n",
       "            }\n",
       "\n",
       "            document.getElementById(chartID).style.display = \"block\";\n",
       "            evt.currentTarget.className += \" active\";\n",
       "        }\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x5ee02b0>"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Bar, Line, Tab\n",
    "x_data = ['小米', '三星', '华为', '苹果', '魅族', 'vivo', 'OPPO']\n",
    "y_a = [107, 36, 102, 91, 51, 113, 45]\n",
    "y_b = [104, 60, 33, 138, 105, 111, 91]\n",
    "bar = (\n",
    "    Bar()\n",
    "    .add_xaxis(x_data)\n",
    "    .add_yaxis(\"商家A\", y_a)\n",
    "    .add_yaxis(\"商家B\", y_b)\n",
    "    .set_global_opts(yaxis_opts=opts.AxisOpts(name=\"销售额(万元)\", name_location=\"center\", name_gap=30))\n",
    ")\n",
    "line = (\n",
    "    Line()\n",
    "    .add_xaxis(x_data)\n",
    "    .add_yaxis(\"商家A\", y_a)\n",
    "    .add_yaxis(\"商家B\", y_b)\n",
    "    .set_global_opts(yaxis_opts=opts.AxisOpts(name=\"销售额(万元)\", name_location=\"center\", name_gap=30))\n",
    ")\n",
    "# 创建组合图表, 并以单击选项卡的方式显示柱形图或折线图\n",
    "tab = Tab()\n",
    "tab.add(bar, \"柱形图\")\n",
    "tab.add(line, \"折线图\")\n",
    "tab.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.4.4　时间线轮播多图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"4fecba6c8a6e436db0980d98915455db\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_4fecba6c8a6e436db0980d98915455db = echarts.init(\n",
       "                    document.getElementById('4fecba6c8a6e436db0980d98915455db'), 'white', {renderer: 'canvas'});\n",
       "                var option_4fecba6c8a6e436db0980d98915455db = {\n",
       "    \"baseOption\": {\n",
       "        \"series\": [\n",
       "            {\n",
       "                \"type\": \"bar\",\n",
       "                \"name\": \" \\u5546\\u5bb6 A\",\n",
       "                \"legendHoverLink\": true,\n",
       "                \"data\": [\n",
       "                    148,\n",
       "                    148,\n",
       "                    105,\n",
       "                    38,\n",
       "                    34,\n",
       "                    81,\n",
       "                    136\n",
       "                ],\n",
       "                \"showBackground\": false,\n",
       "                \"barMinHeight\": 0,\n",
       "                \"barCategoryGap\": \"20%\",\n",
       "                \"barGap\": \"30%\",\n",
       "                \"large\": false,\n",
       "                \"largeThreshold\": 400,\n",
       "                \"seriesLayoutBy\": \"column\",\n",
       "                \"datasetIndex\": 0,\n",
       "                \"clip\": true,\n",
       "                \"zlevel\": 0,\n",
       "                \"z\": 2,\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"margin\": 8\n",
       "                }\n",
       "            },\n",
       "            {\n",
       "                \"type\": \"bar\",\n",
       "                \"name\": \" \\u5546\\u5bb6 B\",\n",
       "                \"legendHoverLink\": true,\n",
       "                \"data\": [\n",
       "                    31,\n",
       "                    137,\n",
       "                    148,\n",
       "                    35,\n",
       "                    141,\n",
       "                    118,\n",
       "                    40\n",
       "                ],\n",
       "                \"showBackground\": false,\n",
       "                \"barMinHeight\": 0,\n",
       "                \"barCategoryGap\": \"20%\",\n",
       "                \"barGap\": \"30%\",\n",
       "                \"large\": false,\n",
       "                \"largeThreshold\": 400,\n",
       "                \"seriesLayoutBy\": \"column\",\n",
       "                \"datasetIndex\": 0,\n",
       "                \"clip\": true,\n",
       "                \"zlevel\": 0,\n",
       "                \"z\": 2,\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"margin\": 8\n",
       "                }\n",
       "            }\n",
       "        ],\n",
       "        \"timeline\": {\n",
       "            \"axisType\": \"category\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"autoPlay\": false,\n",
       "            \"controlPosition\": \"left\",\n",
       "            \"loop\": true,\n",
       "            \"rewind\": false,\n",
       "            \"show\": true,\n",
       "            \"inverse\": false,\n",
       "            \"bottom\": \"-5px\",\n",
       "            \"data\": [\n",
       "                \"2015\\u5e74\",\n",
       "                \"2016\\u5e74\",\n",
       "                \"2017\\u5e74\",\n",
       "                \"2018\\u5e74\",\n",
       "                \"2019\\u5e74\"\n",
       "            ]\n",
       "        },\n",
       "        \"xAxis\": [\n",
       "            {\n",
       "                \"show\": true,\n",
       "                \"scale\": false,\n",
       "                \"nameLocation\": \"end\",\n",
       "                \"nameGap\": 15,\n",
       "                \"gridIndex\": 0,\n",
       "                \"inverse\": false,\n",
       "                \"offset\": 0,\n",
       "                \"splitNumber\": 5,\n",
       "                \"minInterval\": 0,\n",
       "                \"splitLine\": {\n",
       "                    \"show\": false,\n",
       "                    \"lineStyle\": {\n",
       "                        \"show\": true,\n",
       "                        \"width\": 1,\n",
       "                        \"opacity\": 1,\n",
       "                        \"curveness\": 0,\n",
       "                        \"type\": \"solid\"\n",
       "                    }\n",
       "                },\n",
       "                \"data\": [\n",
       "                    \"\\u6cb3\\u9a6c\",\n",
       "                    \"\\u87d2\\u86c7\",\n",
       "                    \"\\u8001\\u864e\",\n",
       "                    \"\\u5927\\u8c61\",\n",
       "                    \"\\u5154\\u5b50\",\n",
       "                    \"\\u718a\\u732b\",\n",
       "                    \"\\u72ee\\u5b50\"\n",
       "                ]\n",
       "            }\n",
       "        ],\n",
       "        \"yAxis\": [\n",
       "            {\n",
       "                \"name\": \"\\u9500\\u552e\\u989d ( \\u4e07)\",\n",
       "                \"show\": true,\n",
       "                \"scale\": false,\n",
       "                \"nameLocation\": \"center\",\n",
       "                \"nameGap\": 30,\n",
       "                \"gridIndex\": 0,\n",
       "                \"inverse\": false,\n",
       "                \"offset\": 0,\n",
       "                \"splitNumber\": 5,\n",
       "                \"minInterval\": 0,\n",
       "                \"splitLine\": {\n",
       "                    \"show\": false,\n",
       "                    \"lineStyle\": {\n",
       "                        \"show\": true,\n",
       "                        \"width\": 1,\n",
       "                        \"opacity\": 1,\n",
       "                        \"curveness\": 0,\n",
       "                        \"type\": \"solid\"\n",
       "                    }\n",
       "                }\n",
       "            }\n",
       "        ]\n",
       "    },\n",
       "    \"options\": [\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \" \\u5546\\u5bb6 A\",\n",
       "                        \" \\u5546\\u5bb6 B\"\n",
       "                    ],\n",
       "                    \"selected\": {\n",
       "                        \" \\u5546\\u5bb6 A\": true,\n",
       "                        \" \\u5546\\u5bb6 B\": true\n",
       "                    },\n",
       "                    \"show\": true,\n",
       "                    \"padding\": 5,\n",
       "                    \"itemGap\": 10,\n",
       "                    \"itemWidth\": 25,\n",
       "                    \"itemHeight\": 14\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"type\": \"bar\",\n",
       "                    \"name\": \" \\u5546\\u5bb6 A\",\n",
       "                    \"legendHoverLink\": true,\n",
       "                    \"data\": [\n",
       "                        123,\n",
       "                        68,\n",
       "                        142,\n",
       "                        146,\n",
       "                        88,\n",
       "                        29,\n",
       "                        76\n",
       "                    ],\n",
       "                    \"showBackground\": false,\n",
       "                    \"barMinHeight\": 0,\n",
       "                    \"barCategoryGap\": \"20%\",\n",
       "                    \"barGap\": \"30%\",\n",
       "                    \"large\": false,\n",
       "                    \"largeThreshold\": 400,\n",
       "                    \"seriesLayoutBy\": \"column\",\n",
       "                    \"datasetIndex\": 0,\n",
       "                    \"clip\": true,\n",
       "                    \"zlevel\": 0,\n",
       "                    \"z\": 2,\n",
       "                    \"label\": {\n",
       "                        \"show\": true,\n",
       "                        \"position\": \"top\",\n",
       "                        \"margin\": 8\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"type\": \"bar\",\n",
       "                    \"name\": \" \\u5546\\u5bb6 B\",\n",
       "                    \"legendHoverLink\": true,\n",
       "                    \"data\": [\n",
       "                        144,\n",
       "                        79,\n",
       "                        106,\n",
       "                        83,\n",
       "                        63,\n",
       "                        100,\n",
       "                        59\n",
       "                    ],\n",
       "                    \"showBackground\": false,\n",
       "                    \"barMinHeight\": 0,\n",
       "                    \"barCategoryGap\": \"20%\",\n",
       "                    \"barGap\": \"30%\",\n",
       "                    \"large\": false,\n",
       "                    \"largeThreshold\": 400,\n",
       "                    \"seriesLayoutBy\": \"column\",\n",
       "                    \"datasetIndex\": 0,\n",
       "                    \"clip\": true,\n",
       "                    \"zlevel\": 0,\n",
       "                    \"z\": 2,\n",
       "                    \"label\": {\n",
       "                        \"show\": true,\n",
       "                        \"position\": \"top\",\n",
       "                        \"margin\": 8\n",
       "                    }\n",
       "                }\n",
       "            ],\n",
       "            \"xAxis\": [\n",
       "                {\n",
       "                    \"show\": true,\n",
       "                    \"scale\": false,\n",
       "                    \"nameLocation\": \"end\",\n",
       "                    \"nameGap\": 15,\n",
       "                    \"gridIndex\": 0,\n",
       "                    \"inverse\": false,\n",
       "                    \"offset\": 0,\n",
       "                    \"splitNumber\": 5,\n",
       "                    \"minInterval\": 0,\n",
       "                    \"splitLine\": {\n",
       "                        \"show\": false,\n",
       "                        \"lineStyle\": {\n",
       "                            \"show\": true,\n",
       "                            \"width\": 1,\n",
       "                            \"opacity\": 1,\n",
       "                            \"curveness\": 0,\n",
       "                            \"type\": \"solid\"\n",
       "                        }\n",
       "                    },\n",
       "                    \"data\": [\n",
       "                        \"\\u6cb3\\u9a6c\",\n",
       "                        \"\\u87d2\\u86c7\",\n",
       "                        \"\\u8001\\u864e\",\n",
       "                        \"\\u5927\\u8c61\",\n",
       "                        \"\\u5154\\u5b50\",\n",
       "                        \"\\u718a\\u732b\",\n",
       "                        \"\\u72ee\\u5b50\"\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"yAxis\": [\n",
       "                {\n",
       "                    \"name\": \"\\u9500\\u552e\\u989d ( \\u4e07)\",\n",
       "                    \"show\": true,\n",
       "                    \"scale\": false,\n",
       "                    \"nameLocation\": \"center\",\n",
       "                    \"nameGap\": 30,\n",
       "                    \"gridIndex\": 0,\n",
       "                    \"inverse\": false,\n",
       "                    \"offset\": 0,\n",
       "                    \"splitNumber\": 5,\n",
       "                    \"minInterval\": 0,\n",
       "                    \"splitLine\": {\n",
       "                        \"show\": false,\n",
       "                        \"lineStyle\": {\n",
       "                            \"show\": true,\n",
       "                            \"width\": 1,\n",
       "                            \"opacity\": 1,\n",
       "                            \"curveness\": 0,\n",
       "                            \"type\": \"solid\"\n",
       "                        }\n",
       "                    }\n",
       "                }\n",
       "            ],\n",
       "            \"title\": [\n",
       "                {\n",
       "                    \"text\": \"\\u65f6\\u95f4\\u7ebf\\u8f6e\\u64ad\\u67f1\\u5f62\\u56fe\\u793a\\u4f8b\",\n",
       "                    \"padding\": 5,\n",
       "                    \"itemGap\": 10\n",
       "                }\n",
       "            ],\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"showContent\": true,\n",
       "                \"alwaysShowContent\": false,\n",
       "                \"showDelay\": 0,\n",
       "                \"hideDelay\": 100,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0,\n",
       "                \"padding\": 5\n",
       "            },\n",
       "            \"color\": [\n",
       "                \"#c23531\",\n",
       "                \"#2f4554\",\n",
       "                \"#61a0a8\",\n",
       "                \"#d48265\",\n",
       "                \"#749f83\",\n",
       "                \"#ca8622\",\n",
       "                \"#bda29a\",\n",
       "                \"#6e7074\",\n",
       "                \"#546570\",\n",
       "                \"#c4ccd3\",\n",
       "                \"#f05b72\",\n",
       "                \"#ef5b9c\",\n",
       "                \"#f47920\",\n",
       "                \"#905a3d\",\n",
       "                \"#fab27b\",\n",
       "                \"#2a5caa\",\n",
       "                \"#444693\",\n",
       "                \"#726930\",\n",
       "                \"#b2d235\",\n",
       "                \"#6d8346\",\n",
       "                \"#ac6767\",\n",
       "                \"#1d953f\",\n",
       "                \"#6950a1\",\n",
       "                \"#918597\"\n",
       "            ]\n",
       "        },\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \" \\u5546\\u5bb6 A\",\n",
       "                        \" \\u5546\\u5bb6 B\"\n",
       "                    ],\n",
       "                    \"selected\": {\n",
       "                        \" \\u5546\\u5bb6 A\": true,\n",
       "                        \" \\u5546\\u5bb6 B\": true\n",
       "                    },\n",
       "                    \"show\": true,\n",
       "                    \"padding\": 5,\n",
       "                    \"itemGap\": 10,\n",
       "                    \"itemWidth\": 25,\n",
       "                    \"itemHeight\": 14\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"type\": \"bar\",\n",
       "                    \"name\": \" \\u5546\\u5bb6 A\",\n",
       "                    \"legendHoverLink\": true,\n",
       "                    \"data\": [\n",
       "                        112,\n",
       "                        112,\n",
       "                        69,\n",
       "                        133,\n",
       "                        118,\n",
       "                        38,\n",
       "                        38\n",
       "                    ],\n",
       "                    \"showBackground\": false,\n",
       "                    \"barMinHeight\": 0,\n",
       "                    \"barCategoryGap\": \"20%\",\n",
       "                    \"barGap\": \"30%\",\n",
       "                    \"large\": false,\n",
       "                    \"largeThreshold\": 400,\n",
       "                    \"seriesLayoutBy\": \"column\",\n",
       "                    \"datasetIndex\": 0,\n",
       "                    \"clip\": true,\n",
       "                    \"zlevel\": 0,\n",
       "                    \"z\": 2,\n",
       "                    \"label\": {\n",
       "                        \"show\": true,\n",
       "                        \"position\": \"top\",\n",
       "                        \"margin\": 8\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"type\": \"bar\",\n",
       "                    \"name\": \" \\u5546\\u5bb6 B\",\n",
       "                    \"legendHoverLink\": true,\n",
       "                    \"data\": [\n",
       "                        45,\n",
       "                        103,\n",
       "                        107,\n",
       "                        48,\n",
       "                        25,\n",
       "                        48,\n",
       "                        95\n",
       "                    ],\n",
       "                    \"showBackground\": false,\n",
       "                    \"barMinHeight\": 0,\n",
       "                    \"barCategoryGap\": \"20%\",\n",
       "                    \"barGap\": \"30%\",\n",
       "                    \"large\": false,\n",
       "                    \"largeThreshold\": 400,\n",
       "                    \"seriesLayoutBy\": \"column\",\n",
       "                    \"datasetIndex\": 0,\n",
       "                    \"clip\": true,\n",
       "                    \"zlevel\": 0,\n",
       "                    \"z\": 2,\n",
       "                    \"label\": {\n",
       "                        \"show\": true,\n",
       "                        \"position\": \"top\",\n",
       "                        \"margin\": 8\n",
       "                    }\n",
       "                }\n",
       "            ],\n",
       "            \"xAxis\": [\n",
       "                {\n",
       "                    \"show\": true,\n",
       "                    \"scale\": false,\n",
       "                    \"nameLocation\": \"end\",\n",
       "                    \"nameGap\": 15,\n",
       "                    \"gridIndex\": 0,\n",
       "                    \"inverse\": false,\n",
       "                    \"offset\": 0,\n",
       "                    \"splitNumber\": 5,\n",
       "                    \"minInterval\": 0,\n",
       "                    \"splitLine\": {\n",
       "                        \"show\": false,\n",
       "                        \"lineStyle\": {\n",
       "                            \"show\": true,\n",
       "                            \"width\": 1,\n",
       "                            \"opacity\": 1,\n",
       "                            \"curveness\": 0,\n",
       "                            \"type\": \"solid\"\n",
       "                        }\n",
       "                    },\n",
       "                    \"data\": [\n",
       "                        \"\\u6cb3\\u9a6c\",\n",
       "                        \"\\u87d2\\u86c7\",\n",
       "                        \"\\u8001\\u864e\",\n",
       "                        \"\\u5927\\u8c61\",\n",
       "                        \"\\u5154\\u5b50\",\n",
       "                        \"\\u718a\\u732b\",\n",
       "                        \"\\u72ee\\u5b50\"\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"yAxis\": [\n",
       "                {\n",
       "                    \"name\": \"\\u9500\\u552e\\u989d ( \\u4e07)\",\n",
       "                    \"show\": true,\n",
       "                    \"scale\": false,\n",
       "                    \"nameLocation\": \"center\",\n",
       "                    \"nameGap\": 30,\n",
       "                    \"gridIndex\": 0,\n",
       "                    \"inverse\": false,\n",
       "                    \"offset\": 0,\n",
       "                    \"splitNumber\": 5,\n",
       "                    \"minInterval\": 0,\n",
       "                    \"splitLine\": {\n",
       "                        \"show\": false,\n",
       "                        \"lineStyle\": {\n",
       "                            \"show\": true,\n",
       "                            \"width\": 1,\n",
       "                            \"opacity\": 1,\n",
       "                            \"curveness\": 0,\n",
       "                            \"type\": \"solid\"\n",
       "                        }\n",
       "                    }\n",
       "                }\n",
       "            ],\n",
       "            \"title\": [\n",
       "                {\n",
       "                    \"text\": \"\\u65f6\\u95f4\\u7ebf\\u8f6e\\u64ad\\u67f1\\u5f62\\u56fe\\u793a\\u4f8b\",\n",
       "                    \"padding\": 5,\n",
       "                    \"itemGap\": 10\n",
       "                }\n",
       "            ],\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"showContent\": true,\n",
       "                \"alwaysShowContent\": false,\n",
       "                \"showDelay\": 0,\n",
       "                \"hideDelay\": 100,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0,\n",
       "                \"padding\": 5\n",
       "            },\n",
       "            \"color\": [\n",
       "                \"#c23531\",\n",
       "                \"#2f4554\",\n",
       "                \"#61a0a8\",\n",
       "                \"#d48265\",\n",
       "                \"#749f83\",\n",
       "                \"#ca8622\",\n",
       "                \"#bda29a\",\n",
       "                \"#6e7074\",\n",
       "                \"#546570\",\n",
       "                \"#c4ccd3\",\n",
       "                \"#f05b72\",\n",
       "                \"#ef5b9c\",\n",
       "                \"#f47920\",\n",
       "                \"#905a3d\",\n",
       "                \"#fab27b\",\n",
       "                \"#2a5caa\",\n",
       "                \"#444693\",\n",
       "                \"#726930\",\n",
       "                \"#b2d235\",\n",
       "                \"#6d8346\",\n",
       "                \"#ac6767\",\n",
       "                \"#1d953f\",\n",
       "                \"#6950a1\",\n",
       "                \"#918597\"\n",
       "            ]\n",
       "        },\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \" \\u5546\\u5bb6 A\",\n",
       "                        \" \\u5546\\u5bb6 B\"\n",
       "                    ],\n",
       "                    \"selected\": {\n",
       "                        \" \\u5546\\u5bb6 A\": true,\n",
       "                        \" \\u5546\\u5bb6 B\": true\n",
       "                    },\n",
       "                    \"show\": true,\n",
       "                    \"padding\": 5,\n",
       "                    \"itemGap\": 10,\n",
       "                    \"itemWidth\": 25,\n",
       "                    \"itemHeight\": 14\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"type\": \"bar\",\n",
       "                    \"name\": \" \\u5546\\u5bb6 A\",\n",
       "                    \"legendHoverLink\": true,\n",
       "                    \"data\": [\n",
       "                        104,\n",
       "                        147,\n",
       "                        38,\n",
       "                        133,\n",
       "                        32,\n",
       "                        129,\n",
       "                        71\n",
       "                    ],\n",
       "                    \"showBackground\": false,\n",
       "                    \"barMinHeight\": 0,\n",
       "                    \"barCategoryGap\": \"20%\",\n",
       "                    \"barGap\": \"30%\",\n",
       "                    \"large\": false,\n",
       "                    \"largeThreshold\": 400,\n",
       "                    \"seriesLayoutBy\": \"column\",\n",
       "                    \"datasetIndex\": 0,\n",
       "                    \"clip\": true,\n",
       "                    \"zlevel\": 0,\n",
       "                    \"z\": 2,\n",
       "                    \"label\": {\n",
       "                        \"show\": true,\n",
       "                        \"position\": \"top\",\n",
       "                        \"margin\": 8\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"type\": \"bar\",\n",
       "                    \"name\": \" \\u5546\\u5bb6 B\",\n",
       "                    \"legendHoverLink\": true,\n",
       "                    \"data\": [\n",
       "                        65,\n",
       "                        55,\n",
       "                        44,\n",
       "                        125,\n",
       "                        74,\n",
       "                        129,\n",
       "                        87\n",
       "                    ],\n",
       "                    \"showBackground\": false,\n",
       "                    \"barMinHeight\": 0,\n",
       "                    \"barCategoryGap\": \"20%\",\n",
       "                    \"barGap\": \"30%\",\n",
       "                    \"large\": false,\n",
       "                    \"largeThreshold\": 400,\n",
       "                    \"seriesLayoutBy\": \"column\",\n",
       "                    \"datasetIndex\": 0,\n",
       "                    \"clip\": true,\n",
       "                    \"zlevel\": 0,\n",
       "                    \"z\": 2,\n",
       "                    \"label\": {\n",
       "                        \"show\": true,\n",
       "                        \"position\": \"top\",\n",
       "                        \"margin\": 8\n",
       "                    }\n",
       "                }\n",
       "            ],\n",
       "            \"xAxis\": [\n",
       "                {\n",
       "                    \"show\": true,\n",
       "                    \"scale\": false,\n",
       "                    \"nameLocation\": \"end\",\n",
       "                    \"nameGap\": 15,\n",
       "                    \"gridIndex\": 0,\n",
       "                    \"inverse\": false,\n",
       "                    \"offset\": 0,\n",
       "                    \"splitNumber\": 5,\n",
       "                    \"minInterval\": 0,\n",
       "                    \"splitLine\": {\n",
       "                        \"show\": false,\n",
       "                        \"lineStyle\": {\n",
       "                            \"show\": true,\n",
       "                            \"width\": 1,\n",
       "                            \"opacity\": 1,\n",
       "                            \"curveness\": 0,\n",
       "                            \"type\": \"solid\"\n",
       "                        }\n",
       "                    },\n",
       "                    \"data\": [\n",
       "                        \"\\u6cb3\\u9a6c\",\n",
       "                        \"\\u87d2\\u86c7\",\n",
       "                        \"\\u8001\\u864e\",\n",
       "                        \"\\u5927\\u8c61\",\n",
       "                        \"\\u5154\\u5b50\",\n",
       "                        \"\\u718a\\u732b\",\n",
       "                        \"\\u72ee\\u5b50\"\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"yAxis\": [\n",
       "                {\n",
       "                    \"name\": \"\\u9500\\u552e\\u989d ( \\u4e07)\",\n",
       "                    \"show\": true,\n",
       "                    \"scale\": false,\n",
       "                    \"nameLocation\": \"center\",\n",
       "                    \"nameGap\": 30,\n",
       "                    \"gridIndex\": 0,\n",
       "                    \"inverse\": false,\n",
       "                    \"offset\": 0,\n",
       "                    \"splitNumber\": 5,\n",
       "                    \"minInterval\": 0,\n",
       "                    \"splitLine\": {\n",
       "                        \"show\": false,\n",
       "                        \"lineStyle\": {\n",
       "                            \"show\": true,\n",
       "                            \"width\": 1,\n",
       "                            \"opacity\": 1,\n",
       "                            \"curveness\": 0,\n",
       "                            \"type\": \"solid\"\n",
       "                        }\n",
       "                    }\n",
       "                }\n",
       "            ],\n",
       "            \"title\": [\n",
       "                {\n",
       "                    \"text\": \"\\u65f6\\u95f4\\u7ebf\\u8f6e\\u64ad\\u67f1\\u5f62\\u56fe\\u793a\\u4f8b\",\n",
       "                    \"padding\": 5,\n",
       "                    \"itemGap\": 10\n",
       "                }\n",
       "            ],\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"showContent\": true,\n",
       "                \"alwaysShowContent\": false,\n",
       "                \"showDelay\": 0,\n",
       "                \"hideDelay\": 100,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0,\n",
       "                \"padding\": 5\n",
       "            },\n",
       "            \"color\": [\n",
       "                \"#c23531\",\n",
       "                \"#2f4554\",\n",
       "                \"#61a0a8\",\n",
       "                \"#d48265\",\n",
       "                \"#749f83\",\n",
       "                \"#ca8622\",\n",
       "                \"#bda29a\",\n",
       "                \"#6e7074\",\n",
       "                \"#546570\",\n",
       "                \"#c4ccd3\",\n",
       "                \"#f05b72\",\n",
       "                \"#ef5b9c\",\n",
       "                \"#f47920\",\n",
       "                \"#905a3d\",\n",
       "                \"#fab27b\",\n",
       "                \"#2a5caa\",\n",
       "                \"#444693\",\n",
       "                \"#726930\",\n",
       "                \"#b2d235\",\n",
       "                \"#6d8346\",\n",
       "                \"#ac6767\",\n",
       "                \"#1d953f\",\n",
       "                \"#6950a1\",\n",
       "                \"#918597\"\n",
       "            ]\n",
       "        },\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \" \\u5546\\u5bb6 A\",\n",
       "                        \" \\u5546\\u5bb6 B\"\n",
       "                    ],\n",
       "                    \"selected\": {\n",
       "                        \" \\u5546\\u5bb6 A\": true,\n",
       "                        \" \\u5546\\u5bb6 B\": true\n",
       "                    },\n",
       "                    \"show\": true,\n",
       "                    \"padding\": 5,\n",
       "                    \"itemGap\": 10,\n",
       "                    \"itemWidth\": 25,\n",
       "                    \"itemHeight\": 14\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"type\": \"bar\",\n",
       "                    \"name\": \" \\u5546\\u5bb6 A\",\n",
       "                    \"legendHoverLink\": true,\n",
       "                    \"data\": [\n",
       "                        106,\n",
       "                        139,\n",
       "                        82,\n",
       "                        147,\n",
       "                        62,\n",
       "                        99,\n",
       "                        31\n",
       "                    ],\n",
       "                    \"showBackground\": false,\n",
       "                    \"barMinHeight\": 0,\n",
       "                    \"barCategoryGap\": \"20%\",\n",
       "                    \"barGap\": \"30%\",\n",
       "                    \"large\": false,\n",
       "                    \"largeThreshold\": 400,\n",
       "                    \"seriesLayoutBy\": \"column\",\n",
       "                    \"datasetIndex\": 0,\n",
       "                    \"clip\": true,\n",
       "                    \"zlevel\": 0,\n",
       "                    \"z\": 2,\n",
       "                    \"label\": {\n",
       "                        \"show\": true,\n",
       "                        \"position\": \"top\",\n",
       "                        \"margin\": 8\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"type\": \"bar\",\n",
       "                    \"name\": \" \\u5546\\u5bb6 B\",\n",
       "                    \"legendHoverLink\": true,\n",
       "                    \"data\": [\n",
       "                        120,\n",
       "                        88,\n",
       "                        47,\n",
       "                        53,\n",
       "                        112,\n",
       "                        57,\n",
       "                        57\n",
       "                    ],\n",
       "                    \"showBackground\": false,\n",
       "                    \"barMinHeight\": 0,\n",
       "                    \"barCategoryGap\": \"20%\",\n",
       "                    \"barGap\": \"30%\",\n",
       "                    \"large\": false,\n",
       "                    \"largeThreshold\": 400,\n",
       "                    \"seriesLayoutBy\": \"column\",\n",
       "                    \"datasetIndex\": 0,\n",
       "                    \"clip\": true,\n",
       "                    \"zlevel\": 0,\n",
       "                    \"z\": 2,\n",
       "                    \"label\": {\n",
       "                        \"show\": true,\n",
       "                        \"position\": \"top\",\n",
       "                        \"margin\": 8\n",
       "                    }\n",
       "                }\n",
       "            ],\n",
       "            \"xAxis\": [\n",
       "                {\n",
       "                    \"show\": true,\n",
       "                    \"scale\": false,\n",
       "                    \"nameLocation\": \"end\",\n",
       "                    \"nameGap\": 15,\n",
       "                    \"gridIndex\": 0,\n",
       "                    \"inverse\": false,\n",
       "                    \"offset\": 0,\n",
       "                    \"splitNumber\": 5,\n",
       "                    \"minInterval\": 0,\n",
       "                    \"splitLine\": {\n",
       "                        \"show\": false,\n",
       "                        \"lineStyle\": {\n",
       "                            \"show\": true,\n",
       "                            \"width\": 1,\n",
       "                            \"opacity\": 1,\n",
       "                            \"curveness\": 0,\n",
       "                            \"type\": \"solid\"\n",
       "                        }\n",
       "                    },\n",
       "                    \"data\": [\n",
       "                        \"\\u6cb3\\u9a6c\",\n",
       "                        \"\\u87d2\\u86c7\",\n",
       "                        \"\\u8001\\u864e\",\n",
       "                        \"\\u5927\\u8c61\",\n",
       "                        \"\\u5154\\u5b50\",\n",
       "                        \"\\u718a\\u732b\",\n",
       "                        \"\\u72ee\\u5b50\"\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"yAxis\": [\n",
       "                {\n",
       "                    \"name\": \"\\u9500\\u552e\\u989d ( \\u4e07)\",\n",
       "                    \"show\": true,\n",
       "                    \"scale\": false,\n",
       "                    \"nameLocation\": \"center\",\n",
       "                    \"nameGap\": 30,\n",
       "                    \"gridIndex\": 0,\n",
       "                    \"inverse\": false,\n",
       "                    \"offset\": 0,\n",
       "                    \"splitNumber\": 5,\n",
       "                    \"minInterval\": 0,\n",
       "                    \"splitLine\": {\n",
       "                        \"show\": false,\n",
       "                        \"lineStyle\": {\n",
       "                            \"show\": true,\n",
       "                            \"width\": 1,\n",
       "                            \"opacity\": 1,\n",
       "                            \"curveness\": 0,\n",
       "                            \"type\": \"solid\"\n",
       "                        }\n",
       "                    }\n",
       "                }\n",
       "            ],\n",
       "            \"title\": [\n",
       "                {\n",
       "                    \"text\": \"\\u65f6\\u95f4\\u7ebf\\u8f6e\\u64ad\\u67f1\\u5f62\\u56fe\\u793a\\u4f8b\",\n",
       "                    \"padding\": 5,\n",
       "                    \"itemGap\": 10\n",
       "                }\n",
       "            ],\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"showContent\": true,\n",
       "                \"alwaysShowContent\": false,\n",
       "                \"showDelay\": 0,\n",
       "                \"hideDelay\": 100,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0,\n",
       "                \"padding\": 5\n",
       "            },\n",
       "            \"color\": [\n",
       "                \"#c23531\",\n",
       "                \"#2f4554\",\n",
       "                \"#61a0a8\",\n",
       "                \"#d48265\",\n",
       "                \"#749f83\",\n",
       "                \"#ca8622\",\n",
       "                \"#bda29a\",\n",
       "                \"#6e7074\",\n",
       "                \"#546570\",\n",
       "                \"#c4ccd3\",\n",
       "                \"#f05b72\",\n",
       "                \"#ef5b9c\",\n",
       "                \"#f47920\",\n",
       "                \"#905a3d\",\n",
       "                \"#fab27b\",\n",
       "                \"#2a5caa\",\n",
       "                \"#444693\",\n",
       "                \"#726930\",\n",
       "                \"#b2d235\",\n",
       "                \"#6d8346\",\n",
       "                \"#ac6767\",\n",
       "                \"#1d953f\",\n",
       "                \"#6950a1\",\n",
       "                \"#918597\"\n",
       "            ]\n",
       "        },\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \" \\u5546\\u5bb6 A\",\n",
       "                        \" \\u5546\\u5bb6 B\"\n",
       "                    ],\n",
       "                    \"selected\": {\n",
       "                        \" \\u5546\\u5bb6 A\": true,\n",
       "                        \" \\u5546\\u5bb6 B\": true\n",
       "                    },\n",
       "                    \"show\": true,\n",
       "                    \"padding\": 5,\n",
       "                    \"itemGap\": 10,\n",
       "                    \"itemWidth\": 25,\n",
       "                    \"itemHeight\": 14\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"type\": \"bar\",\n",
       "                    \"name\": \" \\u5546\\u5bb6 A\",\n",
       "                    \"legendHoverLink\": true,\n",
       "                    \"data\": [\n",
       "                        148,\n",
       "                        148,\n",
       "                        105,\n",
       "                        38,\n",
       "                        34,\n",
       "                        81,\n",
       "                        136\n",
       "                    ],\n",
       "                    \"showBackground\": false,\n",
       "                    \"barMinHeight\": 0,\n",
       "                    \"barCategoryGap\": \"20%\",\n",
       "                    \"barGap\": \"30%\",\n",
       "                    \"large\": false,\n",
       "                    \"largeThreshold\": 400,\n",
       "                    \"seriesLayoutBy\": \"column\",\n",
       "                    \"datasetIndex\": 0,\n",
       "                    \"clip\": true,\n",
       "                    \"zlevel\": 0,\n",
       "                    \"z\": 2,\n",
       "                    \"label\": {\n",
       "                        \"show\": true,\n",
       "                        \"position\": \"top\",\n",
       "                        \"margin\": 8\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"type\": \"bar\",\n",
       "                    \"name\": \" \\u5546\\u5bb6 B\",\n",
       "                    \"legendHoverLink\": true,\n",
       "                    \"data\": [\n",
       "                        31,\n",
       "                        137,\n",
       "                        148,\n",
       "                        35,\n",
       "                        141,\n",
       "                        118,\n",
       "                        40\n",
       "                    ],\n",
       "                    \"showBackground\": false,\n",
       "                    \"barMinHeight\": 0,\n",
       "                    \"barCategoryGap\": \"20%\",\n",
       "                    \"barGap\": \"30%\",\n",
       "                    \"large\": false,\n",
       "                    \"largeThreshold\": 400,\n",
       "                    \"seriesLayoutBy\": \"column\",\n",
       "                    \"datasetIndex\": 0,\n",
       "                    \"clip\": true,\n",
       "                    \"zlevel\": 0,\n",
       "                    \"z\": 2,\n",
       "                    \"label\": {\n",
       "                        \"show\": true,\n",
       "                        \"position\": \"top\",\n",
       "                        \"margin\": 8\n",
       "                    }\n",
       "                }\n",
       "            ],\n",
       "            \"xAxis\": [\n",
       "                {\n",
       "                    \"show\": true,\n",
       "                    \"scale\": false,\n",
       "                    \"nameLocation\": \"end\",\n",
       "                    \"nameGap\": 15,\n",
       "                    \"gridIndex\": 0,\n",
       "                    \"inverse\": false,\n",
       "                    \"offset\": 0,\n",
       "                    \"splitNumber\": 5,\n",
       "                    \"minInterval\": 0,\n",
       "                    \"splitLine\": {\n",
       "                        \"show\": false,\n",
       "                        \"lineStyle\": {\n",
       "                            \"show\": true,\n",
       "                            \"width\": 1,\n",
       "                            \"opacity\": 1,\n",
       "                            \"curveness\": 0,\n",
       "                            \"type\": \"solid\"\n",
       "                        }\n",
       "                    },\n",
       "                    \"data\": [\n",
       "                        \"\\u6cb3\\u9a6c\",\n",
       "                        \"\\u87d2\\u86c7\",\n",
       "                        \"\\u8001\\u864e\",\n",
       "                        \"\\u5927\\u8c61\",\n",
       "                        \"\\u5154\\u5b50\",\n",
       "                        \"\\u718a\\u732b\",\n",
       "                        \"\\u72ee\\u5b50\"\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"yAxis\": [\n",
       "                {\n",
       "                    \"name\": \"\\u9500\\u552e\\u989d ( \\u4e07)\",\n",
       "                    \"show\": true,\n",
       "                    \"scale\": false,\n",
       "                    \"nameLocation\": \"center\",\n",
       "                    \"nameGap\": 30,\n",
       "                    \"gridIndex\": 0,\n",
       "                    \"inverse\": false,\n",
       "                    \"offset\": 0,\n",
       "                    \"splitNumber\": 5,\n",
       "                    \"minInterval\": 0,\n",
       "                    \"splitLine\": {\n",
       "                        \"show\": false,\n",
       "                        \"lineStyle\": {\n",
       "                            \"show\": true,\n",
       "                            \"width\": 1,\n",
       "                            \"opacity\": 1,\n",
       "                            \"curveness\": 0,\n",
       "                            \"type\": \"solid\"\n",
       "                        }\n",
       "                    }\n",
       "                }\n",
       "            ],\n",
       "            \"title\": [\n",
       "                {\n",
       "                    \"text\": \"\\u65f6\\u95f4\\u7ebf\\u8f6e\\u64ad\\u67f1\\u5f62\\u56fe\\u793a\\u4f8b\",\n",
       "                    \"padding\": 5,\n",
       "                    \"itemGap\": 10\n",
       "                }\n",
       "            ],\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"showContent\": true,\n",
       "                \"alwaysShowContent\": false,\n",
       "                \"showDelay\": 0,\n",
       "                \"hideDelay\": 100,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0,\n",
       "                \"padding\": 5\n",
       "            },\n",
       "            \"color\": [\n",
       "                \"#c23531\",\n",
       "                \"#2f4554\",\n",
       "                \"#61a0a8\",\n",
       "                \"#d48265\",\n",
       "                \"#749f83\",\n",
       "                \"#ca8622\",\n",
       "                \"#bda29a\",\n",
       "                \"#6e7074\",\n",
       "                \"#546570\",\n",
       "                \"#c4ccd3\",\n",
       "                \"#f05b72\",\n",
       "                \"#ef5b9c\",\n",
       "                \"#f47920\",\n",
       "                \"#905a3d\",\n",
       "                \"#fab27b\",\n",
       "                \"#2a5caa\",\n",
       "                \"#444693\",\n",
       "                \"#726930\",\n",
       "                \"#b2d235\",\n",
       "                \"#6d8346\",\n",
       "                \"#ac6767\",\n",
       "                \"#1d953f\",\n",
       "                \"#6950a1\",\n",
       "                \"#918597\"\n",
       "            ]\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_4fecba6c8a6e436db0980d98915455db.setOption(option_4fecba6c8a6e436db0980d98915455db);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x5ec0ee0>"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 导入 pyecharts官方的测试数据\n",
    "from pyecharts.faker import Faker\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Bar, Page, Pie, Timeline\n",
    "# 随机获取一组测试数据\n",
    "x = Faker.choose()\n",
    "tl = Timeline()\n",
    "for i in range(2015, 2020):\n",
    "    bar = (\n",
    "        Bar()\n",
    "        .add_xaxis(x)\n",
    "        # Faker.values() 生成一个包含7 个随机整数的列表\n",
    "        .add_yaxis(\" 商家 A\", Faker.values())\n",
    "        .add_yaxis(\" 商家 B\", Faker.values())\n",
    "        .set_global_opts(title_opts=opts.TitleOpts(\"时间线轮播柱形图示例\"), \n",
    "                         yaxis_opts=opts.AxisOpts(name=\"销售额(万元)\", name_location=\"center\", name_gap=30))\n",
    "    )\n",
    "    tl.add(bar, \"{}年\".format(i))\n",
    "tl.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 9.5　定制图表主题"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'roma':'https://assets.pyecharts.org/assets/themes/roma'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"5858a53cc9b54030a8c4115449c0a32c\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'roma'], function(echarts) {\n",
       "                var chart_5858a53cc9b54030a8c4115449c0a32c = echarts.init(\n",
       "                    document.getElementById('5858a53cc9b54030a8c4115449c0a32c'), 'roma', {renderer: 'canvas'});\n",
       "                var option_5858a53cc9b54030a8c4115449c0a32c = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                107,\n",
       "                36,\n",
       "                102,\n",
       "                91,\n",
       "                51,\n",
       "                113,\n",
       "                45\n",
       "            ],\n",
       "            \"showBackground\": false,\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u5546\\u5bb6B\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                104,\n",
       "                60,\n",
       "                33,\n",
       "                138,\n",
       "                105,\n",
       "                111,\n",
       "                91\n",
       "            ],\n",
       "            \"showBackground\": false,\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\",\n",
       "                \"\\u5546\\u5bb6B\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true,\n",
       "                \"\\u5546\\u5bb6B\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5c0f\\u7c73\",\n",
       "                \"\\u4e09\\u661f\",\n",
       "                \"\\u534e\\u4e3a\",\n",
       "                \"\\u82f9\\u679c\",\n",
       "                \"\\u9b45\\u65cf\",\n",
       "                \"vivo\",\n",
       "                \"OPPO\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\\u9500\\u552e\\u989d(\\u4e07)\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"center\",\n",
       "            \"nameGap\": 30,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u67f1\\u5f62\\u56fe-ROMA\\u4e3b\\u9898\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_5858a53cc9b54030a8c4115449c0a32c.setOption(option_5858a53cc9b54030a8c4115449c0a32c);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x68d66a0>"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Bar\n",
    "from pyecharts.globals import ThemeType\n",
    "x_data = ['小米', '三星', '华为', '苹果', '魅族', 'vivo', 'OPPO']\n",
    "y_a = [107, 36, 102, 91, 51, 113, 45]\n",
    "y_b = [104, 60, 33, 138, 105, 111, 91] \n",
    "bar = (\n",
    "    # 创建 Bar 类对象 , 将图表主题替换为ThemeType.ROMA\n",
    "    Bar(init_opts=opts.InitOpts(theme=ThemeType.ROMA))\n",
    "    .add_xaxis(x_data)\n",
    "    .add_yaxis(\"商家A\", y_a)\n",
    "    .add_yaxis(\"商家B\", y_b)\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"柱形图-ROMA主题\"), \n",
    "                     yaxis_opts=opts.AxisOpts(name=\"销售额(万元)\", name_location=\"center\", name_gap=30))\n",
    ")\n",
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 9.7　实例：虎扑社区分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pyecharts.options as opts\n",
    "from pyecharts.globals import ThemeType\n",
    "from pyecharts.charts import Pie, Line, Map, Page\n",
    "pie_hupu = (\n",
    "    Pie()\n",
    "    # 添加数据\n",
    "    .add(\"\", [('NBA', 232345), ('CBA', 16976), ('国际足球', 44381), \n",
    "              ('中国足球', 124), ('步行街', 512266), ('游戏电竞', 129065), \n",
    "              ('自建板块', 3805), ('运动装备', 35124), ('综合体育', 4454), \n",
    "              ('虎扑社团', 646), ('站务管理', 34467)], center=[\"50%\", \"50%\"], radius=[100, 160])\n",
    "    # 设置标题和图例\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\" 虎扑社区各板块发帖数\"), \n",
    "                     legend_opts=opts.LegendOpts(pos_left=10, pos_top=80, orient='vertical'))\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [],
   "source": [
    "line_hupu = (\n",
    "    Line(init_opts=opts.InitOpts(theme=ThemeType.ROMA))\n",
    "    .add_xaxis(['{} : 00'.format(num) for num in range(24) if num%2 ==0])\n",
    "    .add_yaxis('NBA', [259, 114, 134, 397, 840, 1577, 1413, 713, 647, 448, 462, 514], symbol='diamond', symbol_size=15)\n",
    "    .add_yaxis('虎扑', [1221, 370, 359, 845, 2270, 3582, 2947, 2215, 2106, 1843, 2045, 2178], symbol='triangle',symbol_size=15)\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"虎扑社区和NBA板块24小时发帖数 \"), \n",
    "                     yaxis_opts=opts.AxisOpts(name=\"发帖数(个)\", name_location=\"center\", name_gap=40))\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Map\n",
    "data_map = [['朔城区', 100], ['平鲁区', 70], ['山阴县', 68], ['应县', 40], ['右玉县', 30], ['怀仁县', 30]]\n",
    "map_hupu = (\n",
    "    Map()\n",
    "    .add(\"\", data_map, maptype=\"朔州\")\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"虎扑朔州市用户地域分布\"), visualmap_opts=opts.VisualMapOpts(max_=100))\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', '朔州':'https://assets.pyecharts.org/assets/maps/shan1_xi1_shuo4_zhou1', 'roma':'https://assets.pyecharts.org/assets/themes/roma'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"c700ce4bff6042a6b8b696cc5828f400\" style=\"width:900px; height:500px;\"></div>\n",
       "        <div id=\"c0deb90c3c4b42cb9efacc6ce6184403\" style=\"width:900px; height:500px;\"></div>\n",
       "        <div id=\"f91f757aa6a64511840f4ecf9e88f574\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', '朔州', 'roma'], function(echarts) {\n",
       "                var chart_c700ce4bff6042a6b8b696cc5828f400 = echarts.init(\n",
       "                    document.getElementById('c700ce4bff6042a6b8b696cc5828f400'), 'white', {renderer: 'canvas'});\n",
       "                var option_c700ce4bff6042a6b8b696cc5828f400 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"pie\",\n",
       "            \"clockwise\": true,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"NBA\",\n",
       "                    \"value\": 232345\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"CBA\",\n",
       "                    \"value\": 16976\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u56fd\\u9645\\u8db3\\u7403\",\n",
       "                    \"value\": 44381\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e2d\\u56fd\\u8db3\\u7403\",\n",
       "                    \"value\": 124\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6b65\\u884c\\u8857\",\n",
       "                    \"value\": 512266\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e38\\u620f\\u7535\\u7ade\",\n",
       "                    \"value\": 129065\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u81ea\\u5efa\\u677f\\u5757\",\n",
       "                    \"value\": 3805\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8fd0\\u52a8\\u88c5\\u5907\",\n",
       "                    \"value\": 35124\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7efc\\u5408\\u4f53\\u80b2\",\n",
       "                    \"value\": 4454\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u864e\\u6251\\u793e\\u56e2\",\n",
       "                    \"value\": 646\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7ad9\\u52a1\\u7ba1\\u7406\",\n",
       "                    \"value\": 34467\n",
       "                }\n",
       "            ],\n",
       "            \"radius\": [\n",
       "                100,\n",
       "                160\n",
       "            ],\n",
       "            \"center\": [\n",
       "                \"50%\",\n",
       "                \"50%\"\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"NBA\",\n",
       "                \"CBA\",\n",
       "                \"\\u56fd\\u9645\\u8db3\\u7403\",\n",
       "                \"\\u4e2d\\u56fd\\u8db3\\u7403\",\n",
       "                \"\\u6b65\\u884c\\u8857\",\n",
       "                \"\\u6e38\\u620f\\u7535\\u7ade\",\n",
       "                \"\\u81ea\\u5efa\\u677f\\u5757\",\n",
       "                \"\\u8fd0\\u52a8\\u88c5\\u5907\",\n",
       "                \"\\u7efc\\u5408\\u4f53\\u80b2\",\n",
       "                \"\\u864e\\u6251\\u793e\\u56e2\",\n",
       "                \"\\u7ad9\\u52a1\\u7ba1\\u7406\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"left\": 10,\n",
       "            \"top\": 80,\n",
       "            \"orient\": \"vertical\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \" \\u864e\\u6251\\u793e\\u533a\\u5404\\u677f\\u5757\\u53d1\\u5e16\\u6570\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_c700ce4bff6042a6b8b696cc5828f400.setOption(option_c700ce4bff6042a6b8b696cc5828f400);\n",
       "                var chart_c0deb90c3c4b42cb9efacc6ce6184403 = echarts.init(\n",
       "                    document.getElementById('c0deb90c3c4b42cb9efacc6ce6184403'), 'roma', {renderer: 'canvas'});\n",
       "                var option_c0deb90c3c4b42cb9efacc6ce6184403 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"NBA\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbol\": \"diamond\",\n",
       "            \"symbolSize\": 15,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"0 : 00\",\n",
       "                    259\n",
       "                ],\n",
       "                [\n",
       "                    \"2 : 00\",\n",
       "                    114\n",
       "                ],\n",
       "                [\n",
       "                    \"4 : 00\",\n",
       "                    134\n",
       "                ],\n",
       "                [\n",
       "                    \"6 : 00\",\n",
       "                    397\n",
       "                ],\n",
       "                [\n",
       "                    \"8 : 00\",\n",
       "                    840\n",
       "                ],\n",
       "                [\n",
       "                    \"10 : 00\",\n",
       "                    1577\n",
       "                ],\n",
       "                [\n",
       "                    \"12 : 00\",\n",
       "                    1413\n",
       "                ],\n",
       "                [\n",
       "                    \"14 : 00\",\n",
       "                    713\n",
       "                ],\n",
       "                [\n",
       "                    \"16 : 00\",\n",
       "                    647\n",
       "                ],\n",
       "                [\n",
       "                    \"18 : 00\",\n",
       "                    448\n",
       "                ],\n",
       "                [\n",
       "                    \"20 : 00\",\n",
       "                    462\n",
       "                ],\n",
       "                [\n",
       "                    \"22 : 00\",\n",
       "                    514\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"\\u864e\\u6251\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbol\": \"triangle\",\n",
       "            \"symbolSize\": 15,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"0 : 00\",\n",
       "                    1221\n",
       "                ],\n",
       "                [\n",
       "                    \"2 : 00\",\n",
       "                    370\n",
       "                ],\n",
       "                [\n",
       "                    \"4 : 00\",\n",
       "                    359\n",
       "                ],\n",
       "                [\n",
       "                    \"6 : 00\",\n",
       "                    845\n",
       "                ],\n",
       "                [\n",
       "                    \"8 : 00\",\n",
       "                    2270\n",
       "                ],\n",
       "                [\n",
       "                    \"10 : 00\",\n",
       "                    3582\n",
       "                ],\n",
       "                [\n",
       "                    \"12 : 00\",\n",
       "                    2947\n",
       "                ],\n",
       "                [\n",
       "                    \"14 : 00\",\n",
       "                    2215\n",
       "                ],\n",
       "                [\n",
       "                    \"16 : 00\",\n",
       "                    2106\n",
       "                ],\n",
       "                [\n",
       "                    \"18 : 00\",\n",
       "                    1843\n",
       "                ],\n",
       "                [\n",
       "                    \"20 : 00\",\n",
       "                    2045\n",
       "                ],\n",
       "                [\n",
       "                    \"22 : 00\",\n",
       "                    2178\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"NBA\",\n",
       "                \"\\u864e\\u6251\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"NBA\": true,\n",
       "                \"\\u864e\\u6251\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"0 : 00\",\n",
       "                \"2 : 00\",\n",
       "                \"4 : 00\",\n",
       "                \"6 : 00\",\n",
       "                \"8 : 00\",\n",
       "                \"10 : 00\",\n",
       "                \"12 : 00\",\n",
       "                \"14 : 00\",\n",
       "                \"16 : 00\",\n",
       "                \"18 : 00\",\n",
       "                \"20 : 00\",\n",
       "                \"22 : 00\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\\u53d1\\u5e16\\u6570(\\u4e2a)\",\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"center\",\n",
       "            \"nameGap\": 40,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u864e\\u6251\\u793e\\u533a\\u548cNBA\\u677f\\u575724\\u5c0f\\u65f6\\u53d1\\u5e16\\u6570 \",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_c0deb90c3c4b42cb9efacc6ce6184403.setOption(option_c0deb90c3c4b42cb9efacc6ce6184403);\n",
       "                var chart_f91f757aa6a64511840f4ecf9e88f574 = echarts.init(\n",
       "                    document.getElementById('f91f757aa6a64511840f4ecf9e88f574'), 'white', {renderer: 'canvas'});\n",
       "                var option_f91f757aa6a64511840f4ecf9e88f574 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"map\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"mapType\": \"\\u6714\\u5dde\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u6714\\u57ce\\u533a\",\n",
       "                    \"value\": 100\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e73\\u9c81\\u533a\",\n",
       "                    \"value\": 70\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c71\\u9634\\u53bf\",\n",
       "                    \"value\": 68\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e94\\u53bf\",\n",
       "                    \"value\": 40\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u53f3\\u7389\\u53bf\",\n",
       "                    \"value\": 30\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6000\\u4ec1\\u53bf\",\n",
       "                    \"value\": 30\n",
       "                }\n",
       "            ],\n",
       "            \"roam\": true,\n",
       "            \"aspectScale\": 0.75,\n",
       "            \"nameProperty\": \"name\",\n",
       "            \"selectedMode\": false,\n",
       "            \"zoom\": 1,\n",
       "            \"mapValueCalculation\": \"sum\",\n",
       "            \"showLegendSymbol\": true,\n",
       "            \"emphasis\": {}\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u864e\\u6251\\u6714\\u5dde\\u5e02\\u7528\\u6237\\u5730\\u57df\\u5206\\u5e03\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"visualMap\": {\n",
       "        \"show\": true,\n",
       "        \"type\": \"continuous\",\n",
       "        \"min\": 0,\n",
       "        \"max\": 100,\n",
       "        \"inRange\": {\n",
       "            \"color\": [\n",
       "                \"#50a3ba\",\n",
       "                \"#eac763\",\n",
       "                \"#d94e5d\"\n",
       "            ]\n",
       "        },\n",
       "        \"calculable\": true,\n",
       "        \"inverse\": false,\n",
       "        \"splitNumber\": 5,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"showLabel\": true,\n",
       "        \"itemWidth\": 20,\n",
       "        \"itemHeight\": 140,\n",
       "        \"borderWidth\": 0\n",
       "    }\n",
       "};\n",
       "                chart_f91f757aa6a64511840f4ecf9e88f574.setOption(option_f91f757aa6a64511840f4ecf9e88f574);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x68258b0>"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "page = Page()\n",
    "page.add(pie_hupu, line_hupu, map_hupu)\n",
    "page.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
